Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Classpath

 
Samir Ajgaonkar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Samir Ajgaonkar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic