Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

path vs classpath

 
Rinku Gambhir
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To run a simple program we need to set the path in environment variables
we may specify it in path or classpath variable,

what is the difference between the two

i.e path C:\Program Files\Java\jdk1.5.0_06\bin;
and classpath C:\Program Files\Java\jdk1.5.0_06\bin;

And also in Environment varibale we have User variables and System variables, what is the difference between the two.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The PATH variable contains directories where binary files (e.g. EXE files in Windows) will be looked for.
If you open a command prompt and type "javac", you're supposed to have the "bin" directory of your sdk into the PATH, otherwise you'll get an infamous "Command not found" error message.

The CLASSPATH contains directories (or JAR files), from where your java compiler/runtime will look for .class files (and some others).
For example, "java Hello.class" will not work unless you set the directory (or JAR file) Hello.class is in, into your CLASSPATH.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to add - it is unusual to have a "bin" directory in your CLASSPATH, usually it would contain directories like "lib", "jar"...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic