aspose file tools*
The moose likes Beginning Java and the fly likes I Can't Run any Java Program! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I Can Watch "I Can New topic
Author

I Can't Run any Java Program!

Gary Farms
Ranch Hand

Joined: Jun 24, 2000
Posts: 57
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

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


"JavaRanch, where the deer and the Certified play" - David O'Meara
Marc Shiest
Ranch Hand

Joined: Jun 09, 2001
Posts: 46
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

Joined: Feb 26, 2001
Posts: 5018
    
    8

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=."

Junilu - [How to Ask Questions] [How to Answer Questions]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I Can't Run any Java Program!