Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error

 
mikeshn
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
WHen I compile my program it doesn't give me an error message. But when I run the program it gives me the error message "Exception in thread "main" java.lang.NoSuchMethodError: main" ..
What kind of error it can be?
Thanks
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to set up the classpath
this is what i have in my classpath
set CLASSPATH = .;c:\jdk1.3\bin\;c:\myPackage;
then you can build other folders as subfolders in myPackage and store them all in there you should not have problems after then. It required a reboot on my system.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"mikeshn",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
Mikael Jonasson
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot your main method.
All programs must contain one class that has the following:

It's what "starts" the program.
/Mike
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my mistake sorry , he is right.
 
Rick Prevett
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
which 'he'? classpath or main?
rick
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Val was mistaken when he thought it was a classpath error earlier. In that case the error would have been "Can't find this class".
Mikael was correct when he said it was probably an error in the signature of the main method since the JVM could not find it to start the program.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic