Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA_HOME ,CLASSPATH ,& PATH

 
Lucky J Verma
Ranch Hand
Posts: 278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am comfused what is the exact difference between PATH,CLASSPATH, & JAVA_HOME environmental variables.

i knew ,for javac to work we set classpath ,but now i read ,we need to work on java_home aftere JDK installation.


Do these variables have any existence out of JVM.Means if machine doesnt have JAVA, then only PATH system vairable exists?
 
Amit M Tank
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
path is the place where you define all your executables. So if you have installed java or any other application you might want to edit the path variable.

classpath is the variable where you put all your jars and classes. When you invoke java or javac it uses the classpath variables to load the dependent classes.

JAVA_HOME - this variable is used by lot of application like weblogic, Ant etc. Most of these applications uses JAVA_HOME so as to call java.exe or javac.exe

Hope this helps
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18272
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Lucky J Verma:


Do these variables have any existence out of JVM.Means if machine doesnt have JAVA, then only PATH system vairable exists?


Even if Java is installed, you may not have definitions for CLASSPATH and JAVA_HOME - they're optional and usually you set them in your login script (.bashrc or whatever). Although some products such as Eclipse and Weblogic server require setting up a JAVA_HOME in order to know where the JVM you want to use is located.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic