File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes diff between path & classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "diff between path & classpath" Watch "diff between path & classpath" New topic

diff between path & classpath

balaji karth

Joined: Jan 27, 2006
Posts: 8
hi to all
I want to know the difference between setting path and classpath
I use path for executing java files from a different folder but whats is the use of CLASSPATH then....pls give me a clear idea abt that ...many gave me different answers..
Vishnu Prakash
Ranch Hand

Joined: Nov 15, 2004
Posts: 1026
I had made a tutorial about path and classpath. I would recommend to go through it. You can fint it here

Servlet Spec 2.4/ Jsp Spec 2.0/ JSTL Spec 1.1 - JSTL Tag Documentation
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
In short, PATH is used by the operating system to find executable files (.exe's in Windows) that it can run. CLASSPATH, on the other hand is specifically used by Java to find .class files that are needed when you run a Java program.


Java API Documentation
The Java Tutorial
marc weber

Joined: Aug 31, 2004
Posts: 11343

Setting the PATH variable allows you "to conveniently run the JDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the command." To set the PATH, see these installation instructions for 32-bit Windows. (For other operating systems, click here.)

Setting the CLASSPATH variable "tells JDK tools and applications where to find third-party and user-defined classes." To set the CLASSPATH, see these JavaRanch instructions or Sun instructions.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
balaji karth

Joined: Jan 27, 2006
Posts: 8
thank you
now i have got a clear idea abt that.
I agree. Here's the link:
subject: diff between path & classpath
It's not a secret anymore!