• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

I Can't Run any Java Program!

 
Gary Farms
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every Java program that used to run no longer does. They compile OK, but when I try to run them, I get the following run-time error:
"Exception in thread "main" java.lang.NosuchMethodError" - main
I can't even run a HelloWorld program.
My source and object files are in c:\java
My autoexec.bat file looks like this:
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;.
Does anyone have any idea why I'm getting this run-time error all of a sudden on files that used to run OK?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure there is a space between the word classpath and the first dot. Add the bin directory in like we talked about before. Show us how you are invoking the program.
 
Marc Shiest
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same problem too...I fixed with some help from Cindy ...my problems were: I was copying and pasting the main mehtod...and secondly..I had a bunch of *.java and *.class files in another directory..which I deleted...hope this helps
 
Junilu Lacar
Bartender
Pie
Posts: 7749
60
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gary Farms:

My autoexec.bat file looks like this:
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;.

Gary, the set classpath command should be like this:
set classpath=.;c:\jdk1.3.0_02\lib\tools.jar;c:\java;
Note: no spaces between "classpath=."
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic