Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. [Solved]Fatal Exception occured when running jar file [modified]

[Solved]Fatal Exception occured when running jar file [modified]

Scheduled Pinned Locked Moved Java
questioncsharpc++javalinux
14 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    Jordanwb wrote:

    jordanwb@jordanwb-laptop:/media/DEFB-0C36/PhpDesigner$ java PhpDesigner.jar

    I think that should be:

    java -jar PhpDesigner.jar

    J Offline
    J Offline
    Jordanwb
    wrote on last edited by
    #3

    jordanwb@jordanwb-laptop:/media/DEFB-0C36/PhpDesigner$ java -jar PhpDesigner.jar
    Exception in thread "main" java.lang.NoSuchMethodError: main

    The main method does exist in the startup class. :confused:

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;

    public class MainWindow extends JFrame implements ActionListener
    {
    private JMenuBar main_menu;

    private JMenu file\_menu;
    private JMenuItem new\_project, open\_project, save\_project, save\_project\_as, quit;
    
    private JMenu objects\_menu;
    private JMenuItem add\_folder, add\_file, add\_class, add\_interface, add\_function, add\_parameter, add\_field;
    
    private JPanel php\_object\_manager;
    
    public MainWindow()
    {
        super ("PhpDesigner");
        
        this.setSize (800, 600);
        this.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE);
        
        /\* Set up main menu \*/
        /\* Set up file menu \*/
        this.new\_project = new JMenuItem("New Project", new ImageIcon ("./Images/document-new.png"));
        this.new\_project.addActionListener (this);
        
        this.open\_project = new JMenuItem("Open Project", new ImageIcon ("./Images/document-open.png"));
        this.open\_project.addActionListener (this);
        
        this.save\_project = new JMenuItem("Save Project", new ImageIcon ("./Images/document-save.png"));
        this.save\_project.addActionListener (this);
        
        this.save\_project\_as = new JMenuItem("Save Project As", new ImageIcon ("./Images/document-save-as.png"));
        this.save\_project\_as.addActionListener (this);
        
        this.quit = new JMenuItem("Quit", new ImageIcon ("./Images/system-log-out.png"));
        this.quit.addActionListener (this);
        
        this.file\_menu = new JMenu ("File");
        this.file\_menu.add (this.new\_project);
        this.file\_menu.addSeparator();
        this.file\_menu.add (this.open\_project);
        this.file\_menu.add (this.save\_project);
        this.file\_menu.add (this.save\_project\_as);
        this.file\_menu.addSeparator();
        this.file\_menu.add (this.quit);
        
        this.main\_menu = new JMenuBar ();
        this.main\_menu.add (this.file\_menu);
        
        this.getContentPane().add (this.main\_menu, BorderLayout.NORTH);
        /\* End of setting up file menu \*/
        /\* Set up Objects menu \*/
        
        this.add\_folder = new JMenuItem ("Add Folder");
        this.add\_file = new JMenuItem ("Add Fil
    
    L 1 Reply Last reply
    0
    • J Jordanwb

      jordanwb@jordanwb-laptop:/media/DEFB-0C36/PhpDesigner$ java -jar PhpDesigner.jar
      Exception in thread "main" java.lang.NoSuchMethodError: main

      The main method does exist in the startup class. :confused:

      import java.awt.*;
      import javax.swing.*;
      import java.awt.event.*;
      import java.util.*;

      public class MainWindow extends JFrame implements ActionListener
      {
      private JMenuBar main_menu;

      private JMenu file\_menu;
      private JMenuItem new\_project, open\_project, save\_project, save\_project\_as, quit;
      
      private JMenu objects\_menu;
      private JMenuItem add\_folder, add\_file, add\_class, add\_interface, add\_function, add\_parameter, add\_field;
      
      private JPanel php\_object\_manager;
      
      public MainWindow()
      {
          super ("PhpDesigner");
          
          this.setSize (800, 600);
          this.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE);
          
          /\* Set up main menu \*/
          /\* Set up file menu \*/
          this.new\_project = new JMenuItem("New Project", new ImageIcon ("./Images/document-new.png"));
          this.new\_project.addActionListener (this);
          
          this.open\_project = new JMenuItem("Open Project", new ImageIcon ("./Images/document-open.png"));
          this.open\_project.addActionListener (this);
          
          this.save\_project = new JMenuItem("Save Project", new ImageIcon ("./Images/document-save.png"));
          this.save\_project.addActionListener (this);
          
          this.save\_project\_as = new JMenuItem("Save Project As", new ImageIcon ("./Images/document-save-as.png"));
          this.save\_project\_as.addActionListener (this);
          
          this.quit = new JMenuItem("Quit", new ImageIcon ("./Images/system-log-out.png"));
          this.quit.addActionListener (this);
          
          this.file\_menu = new JMenu ("File");
          this.file\_menu.add (this.new\_project);
          this.file\_menu.addSeparator();
          this.file\_menu.add (this.open\_project);
          this.file\_menu.add (this.save\_project);
          this.file\_menu.add (this.save\_project\_as);
          this.file\_menu.addSeparator();
          this.file\_menu.add (this.quit);
          
          this.main\_menu = new JMenuBar ();
          this.main\_menu.add (this.file\_menu);
          
          this.getContentPane().add (this.main\_menu, BorderLayout.NORTH);
          /\* End of setting up file menu \*/
          /\* Set up Objects menu \*/
          
          this.add\_folder = new JMenuItem ("Add Folder");
          this.add\_file = new JMenuItem ("Add Fil
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #4

      How did you create your 'jar'; did you use a correct manifest file to identify the class containing the main() method?

      J 1 Reply Last reply
      0
      • L Lost User

        How did you create your 'jar'; did you use a correct manifest file to identify the class containing the main() method?

        J Offline
        J Offline
        Jordanwb
        wrote on last edited by
        #5

        I used BlueJ to create the jar which I believe creates the manifest file for me.

        L 1 Reply Last reply
        0
        • J Jordanwb

          I used BlueJ to create the jar which I believe creates the manifest file for me.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #6

          Jordanwb wrote:

          I used BlueJ

          I'm afraid I know nothing about BlueJ so you need to go to the documentation to check it out. Alternatively you could deconstruct the jar file and check the files yourself.

          J 1 Reply Last reply
          0
          • L Lost User

            Jordanwb wrote:

            I used BlueJ

            I'm afraid I know nothing about BlueJ so you need to go to the documentation to check it out. Alternatively you could deconstruct the jar file and check the files yourself.

            J Offline
            J Offline
            Jordanwb
            wrote on last edited by
            #7

            This is the content of the manifest file:

            Main-Class:MainWindow

            L 1 Reply Last reply
            0
            • J Jordanwb

              This is the content of the manifest file:

              Main-Class:MainWindow

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #8

              Sorry, that looks OK, I'm not sure what else to suggest.

              J 1 Reply Last reply
              0
              • L Lost User

                Sorry, that looks OK, I'm not sure what else to suggest.

                J Offline
                J Offline
                Jordanwb
                wrote on last edited by
                #9

                I added String[] args to the args of main () and it works.

                L 1 Reply Last reply
                0
                • J Jordanwb

                  I added String[] args to the args of main () and it works.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #10

                  Interesting; I actually wondered about that yesterday, but did not bother to test it out. To paraphrase Sherlock Holmes: "When you have eliminated the impossible, whatever remains, however improbable, must be the answer".

                  J 1 Reply Last reply
                  0
                  • L Lost User

                    Interesting; I actually wondered about that yesterday, but did not bother to test it out. To paraphrase Sherlock Holmes: "When you have eliminated the impossible, whatever remains, however improbable, must be the answer".

                    J Offline
                    J Offline
                    Jordanwb
                    wrote on last edited by
                    #11

                    It sortof makes sense. Java apps are capable of processing arguments, altough they're infrequently used on Windows. Another thing I forgot was that the first letter of a method is always lowercase. I had to rename Main (String[]) to main (String[]).

                    L 1 Reply Last reply
                    0
                    • J Jordanwb

                      It sortof makes sense. Java apps are capable of processing arguments, altough they're infrequently used on Windows. Another thing I forgot was that the first letter of a method is always lowercase. I had to rename Main (String[]) to main (String[]).

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #12

                      Jordanwb wrote:

                      It sortof makes sense.

                      As with most things in IT. ;)

                      J 1 Reply Last reply
                      0
                      • L Lost User

                        Jordanwb wrote:

                        It sortof makes sense.

                        As with most things in IT. ;)

                        J Offline
                        J Offline
                        Jordanwb
                        wrote on last edited by
                        #13

                        I had upgraded QuickBooks 2009 to 2010 edition for my dad. The conversion started off at taking four hours, then down t 2 and a half hours, down to twelve minutes then down to 3. The whole process took around 2 minutes.

                        L 1 Reply Last reply
                        0
                        • J Jordanwb

                          I had upgraded QuickBooks 2009 to 2010 edition for my dad. The conversion started off at taking four hours, then down t 2 and a half hours, down to twelve minutes then down to 3. The whole process took around 2 minutes.

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #14

                          Umm, I think maybe this belongs to an alternative thread. :confused:

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups