aspose file tools*
The moose likes Beginning Java and the fly likes PATH and CLASSPATH Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "PATH and CLASSPATH" Watch "PATH and CLASSPATH" New topic
Author

PATH and CLASSPATH

kiran vydhyam
Greenhorn

Joined: Jul 22, 2004
Posts: 7
I have a huge confusion between these two terms,atlast I had to post it here.
Please explain me what are it's actual uses,what is the difference between them,and how should I set it and where should I set it.

I encountered this problem when I was trying to enable the assertions in the package level,and it was not able to find my classes.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Hi,

Welcome to JavaRanch!

PATH is an environment variable used by several different operating systems (both Windows and UNIX) to find program files (*.EXE files.) It always consists of a list of directories. If you type, say, WINWORD.EXE, the OS looks in each directory named on the PATH to find this program file.

Note that PATH has nothing to do with Java, except that the OS will use the PATH to find JAVA.EXE and JAVAC.EXE, etc.

CLASSPATH is an environment variable used by Java (and only by Java) to find .class files. It is a list of directories and/or .jar files that contain classes. When Java needs to load a class, it will look in all the locations named by the CLASSPATH.

Note that the OS has absolutely no use for CLASSPATH and couldn't care less what you've set it to (or not.)

You might be interested in the JavaRanch FAQ on How to set the classpath.


[Jess in Action][AskingGoodQuestions]
kiran vydhyam
Greenhorn

Joined: Jul 22, 2004
Posts: 7
Thankyou so much.It was so nicely explained.I will never be confused about these two terms till my last breath.

Thanks again
 
jQuery in Action, 2nd edition
 
subject: PATH and CLASSPATH