Results 1 to 6 of 6
  1. #1
    ferdzz is offline Member
    Join Date
    Jun 2010
    Posts
    12
    Rep Power
    0

    Default Question about error "Exception in thread "main" java.lang.NoSuchMethodError: main

    Hi all,

    I was wondering what this error message meant


    Exception in thread "main" java.lang.NoSuchMethodError: main

    ...

    My program compiles fine but it always gives me this error at run time,
    Here is my main method

    Java Code:
    public static void main(String[] args) {
        	new Thread(new Runnable(){
    			public void run(){
    				Minesweeper panel = new Minesweeper(20,20,50);
    				JFrame frame = new JFrame("Minesweeper");
    				frame.validate();
    				frame.pack();
    				frame.setContentPane(panel);
    				frame.setVisible(true);
    			}
    		}).start();
    	}
    If someone can help me out with this issue, it'd be greatly appreciated ! :D
    Last edited by Eranga; 06-22-2010 at 12:11 PM. Reason: code tags added

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,830
    Rep Power
    19

    Default

    How are you running this?
    What's the command?

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Also show the command that was issued and the contents of the folder where the command was issued.

  5. #5
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  6. #6
    ferdzz is offline Member
    Join Date
    Jun 2010
    Posts
    12
    Rep Power
    0

    Default

    After debugging more debugging, i figured out that i was implementing the main method inside an inner class, when i moved it to the super class, it actually ran fine. Thanks everyone!

Similar Threads

  1. Replies: 8
    Last Post: 02-23-2010, 12:22 PM
  2. Replies: 1
    Last Post: 11-20-2009, 07:58 PM
  3. Replies: 1
    Last Post: 07-16-2009, 10:35 AM
  4. Replies: 1
    Last Post: 08-07-2007, 07:10 AM
  5. Replies: 1
    Last Post: 07-25-2007, 10:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •