File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Error" Watch "Error" New topic



Joined: May 16, 2001
Posts: 3
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?
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
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.

Val SCJP <BR>going for SCJD
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at . 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.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Mikael Jonasson
Ranch Hand

Joined: May 16, 2001
Posts: 158
You forgot your main method.
All programs must contain one class that has the following:

It's what "starts" the program.
Val Dra
Ranch Hand

Joined: Jan 26, 2001
Posts: 439
my mistake sorry , he is right.
Rick Prevett
Ranch Hand

Joined: Apr 16, 2001
Posts: 68
which 'he'? classpath or main?
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
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.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: Error
jQuery in Action, 3rd edition