Forums Register Login

I Can't Run any Java Programs!

+Pie Number of slices to send: Send
All of a sudden, my Java programs won't run. They compile OK, but when I try to run them, I get the following error message:
"Exception in thread "main" java.lang.NoSuchMethodError - main
My source and object files are in c:\java.
My c:\autoexec.bat looks as follows:
path=c:\windows;c:\windows\command;c:\jdk1.3.0_02\bin;c:\java;.
set classpath=c:\jdk1.3.0_02\lib\tools.jar;c:\java;.

Why am I getting this run-time error all of a sudden? These programs used to run OK. Does anyone have any idea? Any help would be greatly appreciated. Thanks!
Gary Farms
+Pie Number of slices to send: Send
Well, according to the Error the VM is looking for your "main"
method. Double check to see if you have it and make sure
the signature are: public static void main(String[] args)
any other signature won't do.
Good luck,
Ryo
+Pie Number of slices to send: Send
Sometimes it is better to have the current directory at the front of the classpath, so it is better to set classpath like this:
set classpath = .;%classpath%
This error is almost always a classpath error.
Julia
+Pie Number of slices to send: Send
Yeah, Ryo is right. If it was a classpath problem you would be getting a class not found error. Therefore the JVM is finding the file, just not the main method.
You know that last time someone REALLY had problems like this, it turned out that he had set up a Macro to spit out the
"public static void main(String args[]){"
line, and the macro was putting some non-visible character on the line that made the JVM not recognize the signature for main.
Try retyping that whole line by hand and re-compiling.
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1465 times.
Similar Threads
2 Questions - I'm Really At A Loss!
I Can't Run any Java Program!
(newbie) error message when starting the j2ee server
Classpath question
2 Questions - I'm really at a loss!
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 06:06:35.