I would like to know what is JAVA_HOME. Where do I set the path of javac.exe and java.exe. It is in environment variables. When I compile a Java program from command prompt, how does the JVM find javac.exe
?
JAVA_HOME is an operating system (OS) environment variable which can optionally be set after either the Java Development Kit (JDK) or the Java Runtime Environment (JRE) is installed. The JAVA_HOME environment variable points to the file system location where the JDK or JRE was installed.
Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1. 7.0_02\bin and copy the address. Go to Control Panel. Environment Variables and Insert the address at the beginning of var.
Verify JAVA_HOME Open a Command Prompt window (Win⊞ + R, type cmd, hit Enter). Enter the command echo %JAVA_HOME% . This should output the path to your Java installation folder. If it doesn't, your JAVA_HOME variable was not set correctly.
JAVA_HOME = C:\Program Files\Java\jdk1.7.0 [Location of your JDK Installation Directory] Once you have the JDK installation path: Right-click the My Computer icon on. Select Properties. Click the Advanced system setting tab on left side of your screen.
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, other Java EE app servers and build tools such as Gradle
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With