This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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
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?)
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
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).]