This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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: 38517
    
  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 ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: path v classpath