Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

path v classpath

 
Ajay srini
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jack Leeyohn
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
google
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic