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

path v classpath

Ajay srini
Greenhorn

Joined: Sep 22, 2008
Posts: 1
Hi all,

I am new to java.
can anyone tell me wat is the difference between path and a class path
and also how to set the both in command prompt.
[ September 22, 2008: Message edited by: David O'Meara ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

The "path" is the path the operating system uses to find execuatables. The "classpath" is the path the JVM's class loader uses to find classes (and other resources). Have a read of our FAQ on the subject.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jack Leeyohn
Greenhorn

Joined: Sep 21, 2008
Posts: 2
google
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38363
    
  23
Originally posted by yohn lee:
google
I think Paul Sturrock's answer was much more useful.

This old thread has details of setting the PATH on Windows from the command line. It would probably be better to add the java part to the beginning of the PATH.

On Linux it varies, but you write something like

export PATH=/usr/bin/java/jdk1.6.0_07/bin/:$PATH

Note the Java entry always ends with "bin".

[edit]Add: You don't usually need to set the classpath as an environment variable[/edit]
[ September 22, 2008: Message edited by: Campbell Ritchie ]
 
jQuery in Action, 2nd edition
 
subject: path v classpath