Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is JAVA_HOME? How does the JVM find the javac path stored in JAVA_HOME?

Tags:

java

core

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?

like image 853
giri Avatar asked Jan 08 '10 03:01

giri


People also ask

What is $Java_home?

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.

How do I find javac path?

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.

How do I find my JAVA_HOME path?

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.

What is JAVA_HOME path for Windows?

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.


1 Answers

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.

like image 186
duffymo Avatar answered Sep 18 '22 18:09

duffymo