my dog learned polymorphism
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
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Classpath " Watch "Classpath " New topic


Jumpy David

Joined: Jan 17, 2001
Posts: 10
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,
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.
I agree. Here's the link:
subject: Classpath
It's not a secret anymore!