This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I had set classpath to CLASSPATH=".;c:\jdk1.3\jre\lib\servlet.jar;c:\jdk1.3\jre\lib\rt.jar;c:\jdk1.3\lib\tools.jar;c:\jdk1.3\lib\dt.jar" in autoexec.bat on Win 98 system.
I always got the NOCLASSDEFFOUND error when I tried to run my java class. Compiling was fine. So while searching on google i found info on how to setup textpad for compiling java. In that it was mentioned to set classpath to "." when I did set it I could run the sample program i wanted to run. Isn't classpath supposed to include all the possible class directories? So why just a "." works ? Also I had included "." in my setting which did not work ? Any clues? thanks.
Ok, you have to add a "." in the class path so that it includes the classes in the current working directory while executing a class. So if you are in C:\java\> and if you give a java command then the classes in C:\java\> directory will also be added to your classpath if you include a "." in it.
First try to compile and run your java code in a command prompt. If you dint get any error ( NoClassDefFound error ) then check with the help in Textpad. I've worked in it long back .There should be some way to set the classpath in it.
If you have any classes or jars in path like C:\Program files\java\myclass.jar then this path should be mentoined in double quotes ( "C:\Program files\java\myclass.jar" ) in the classpath, because of the space in "program files" . [ July 27, 2005: Message edited by: Srinivasa Raghavan ]
Srini, thanks for your reply. But as I had mentioned , I had included the "." in the beginning of the long classpath I had set. That did not work. Only when I removed everything else did it work for me. Also compiling was not a problem in both cases. So I am baffled.
My understanding is that every jar in c:\jdk1.3\jre\lib is automatically included by the JVM in the "boot classpath". Perhaps by including it again in your classpath, it created the problem you mention (although I've never tried to include all the other stuff you included).
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Sep 28, 2004
Just try this.. Open a command prompt and give this command " Set classpath" this will now display the value of the system variable 'CLASSPATH'. Check whether the the value of it has complete path.
As said by Marilyn every jar in c:\jdk\jre\lib is automatically included by the JVM. In my classpath i only have a jar file plus a '.' [ July 28, 2005: Message edited by: Srinivasa Raghavan ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com