Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Classpath " Watch "Classpath " New topic
Author

Classpath

Jumpy David
Greenhorn

Joined: Jan 17, 2001
Posts: 10
Hi!
I have set the classpath to C:\jdk1.2.2\lib. There is a jar file mail.jar in C:\jdk1.2.2\lib ...but it is not recognised by the classpath until and unless I explicitly include it in class path as C:\jdk1.2.2\lib\mail.jar. Why should it be so..? Do I need to put all the jar files in lib directory explicitly in the classpath to make them accessible.
Thanks and Regards,
Jumpy
Matthew Jones
Ranch Hand

Joined: Dec 21, 2000
Posts: 68
Yes, all jar files you create have to be included in the classpath statement if you want java to find them.
The CLASSPATH tells java where to looks for class files just like the PATH tells DOS to look for .bat, .exe, etc. files.
If you have the directory the jar file your class files are in included in the CLASSPATH, it will look in that directory for the class files, but won't look in the jar file unless you tell it to.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Classpath
 
Similar Threads
help apache axis
Tomcat
NoClassDefFoundError: javax/mail/Message
Class path setting problem in J2ee server
Couldn't compile the servlets