the directory is right, thats where my .java file is the javac command executes fine and creates the .class file but when i give the java command to interpret the file i get the following error Exception in thread main: java.lang.NoClassDefFoundError : HelloWorld i have given whatever classpath i needed to give, note though that when i installed jdk1.3, i had a src.jar file which i think is the file where the path should point to, this was initially not located in the lib folder
Joined: Nov 06, 2000
If your class is in a package, make sure you also include tha package name when trying to interpret. You can do a fimd for the class file created, then navigate to that directory and issue the command from there.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Joined: Jul 08, 2001
The problem isn't with java.exe not running. If it couldn't find the file, it would say "Bad Command or file name" (win 9x). Post your source code. That error indicates that it's having a problem with your main method (like maybe it isn't there?)
Joined: Dec 20, 2000
Most likely it was an error of wrong class path. Just type set classpath=.; and see what happens.
Joined: Sep 29, 2000
src.jar has NOTHING to do with anything. That is just included with the stuff so that you can read the Sun code if you want. The CLASSPATH should include the \bin where the Sun files are, the "." current directory (probably) for convenience, and the directory where YOUR class file reside.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Joined: Jul 14, 2001
Try this -- at the command prompt give java classname where classname is the name of the class as you specified in your code keeping in mind that Java is case sensitive . If this makes your code work then what u need to do is save the file as "HelloWorld.java" & make sure that the class name in your code is "Helloworld" . And if it is not this simple excuse my ignorance . [This message has been edited by Ashish Hareet (edited July 14, 2001).] [This message has been edited by Ashish Hareet (edited July 14, 2001).]
Joined: Jan 06, 2001
you have to set your classpath for the current directory where your java file is at.