Why do we need JAVA_HOME and CLASSPATH

I just used PATH system variable and had the jdk1.5.0_18\bin  point to it apart from other folders. This way I was able to run my simple Java programs without any problem. I also learnt that Java installs the interpreter file java.exe in %SYSTEM_ROOT%/system32 folder.  I deleted that file java.exe but my simple one liner class continued to compile from anywhere using javac and run using java.

Why then do we need these two variables ,   JAVA_HOME and CLASSPATH?

Who is Participating?
Thomas4019Connect With a Mentor Commented:
JAVA_HOME refers to where the JDK is installed.
CLASSPATH refers to all the directories where to search for class files.
objectsConnect With a Mentor Commented:
you don't really, certainly not for simply compiling and running java apps

perfect_tranquilityAuthor Commented:
Fantastic,   be on the look out geeks. My next question is soon to be up here on packages and classes and using classpath and compiling them.

Thanks!  Great answers

All Courses

From novice to tech pro — start learning today.