| Author |
path vs classpath
|
Gaurav
Greenhorn
Joined: Apr 17, 2007
Posts: 5
|
|
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
Joined: Nov 24, 2005
Posts: 14672
|
|
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.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Barry Gaunt
Ranch Hand
Joined: Aug 03, 2002
Posts: 7729
|
|
|
Just to add - it is unusual to have a "bin" directory in your CLASSPATH, usually it would contain directories like "lib", "jar"...
|
Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
|
 |
 |
|
|
subject: path vs classpath
|
|
|