• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
GuessGame.class:

Player:

GameLauncher.class


What am I doing wrong? I read somewhere that you need to use But I'm already doing that, and the code is like this in my book (Head First Java)

Using JDK 1.6.0 update 12 btw

In other words it compiles just fine but won't run.
 
Bartender
Posts: 2270
20
Android Java ME Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which class are you executing?
 
ner ieru
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for replying, I was executing the GuessGame class, and figured oh yeah kinda stupid to execute the class that doesn't have a main function..

However I would like to

But I got the following error:
 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In which case there is probably a compiler error preventing the GameLauncher.class file from being created. Please check whether you have the GameLauncher.class file in you folder. Use the "dir" instruction on Windows or "ls" on Unix/Linux.
You may need to compile the GameLauncher.java file.
 
ner ieru
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:In which case there is probably a compiler error preventing the GameLauncher.class file from being created. Please check whether you have the GameLauncher.class file in you folder. Use the "dir" instruction on Windows or "ls" on Unix/Linux.
You may need to compile the GameLauncher.java file.



That fixed my problem I thank you guys kindly, I'm amazed by how fast you guys always help out!

I'll just continue to annoy the hell out of you guys till I know enough java myself to help others

Btw is it possible to copy text from the cmd to any other application, as I'm trying to by selecting the text I want to copy and using Ctrl+c and Ctrl+v but no success
 
Campbell Ritchie
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which command line are you using? There are hints about copying in this FAQ. On Windows, you can click the top left icon, then you click "edit" on the drop down list, then click highlight text, mark the code with your mouse, then <enter> will copy it to the clipboard. At least I think that's how you do it; I am not on Windows at the moment.

And . . . you're welcome

[edit]It says "mark" on the command prompt menu, not highlight.[/edit]
 
reply
    Bookmark Topic Watch Topic
  • New Topic