tags:

views:

511

answers:

3

Hi I like to know what is JAVA_HOME where I set path of javac.exe and java.exe. It is in environment variables. When I compile java prog from command prompt how does JVM will find the javac.exe?

+5  A: 

JVM does not find java.exe. It doesn't even call it. java.exe is called by the operating system (Windows in this case).

JAVA_HOME is just a convention, usually used by Tomcat and other Java EE app servers to find where Java lives.

The important thing from your point of view is that the Java /bin directory be on your PATH so Windows can find the .exe tools that ship with the JDK: javac.exe, java.exe, jar.exe, etc.

duffymo
A: 

The command prompt wouldn't use JAVA_HOME to find javac.exe, it would use PATH.

Kaleb Brasee
A: 

JAVA_HOME is a environment variable (in Unix terminologies), or a PATH variable (in Windows terminology). A lot of well behaving Java applications (which need the JDK/JRE) to run, looks up the JAVA_HOME variable for the location where the Java compiler/interpreter may be found.

Amit