

For example, with Gradle you can set either PATH or JAVA_HOME and it will run fine. Some modern programs are intelligent enough to extract the JDK location from PATH if JAVA_HOME is not set. Any time you start a program that relies on the JDK in some way, the program uses that pointer to find it.ĭo we need to set both JAVA_HOME and PATH?

The variable can then be used by any program that needs access to the JDK. The JAVA_HOME environment variable is set to the JDK installation directory. By including a program’s directory in PATH it becomes available to use on the command line by name, without having to specify its full path. In Windows, these programs are files which end in. The PATH environment variable consists of a list of directories containing executable programs on your system.

To compile and run Java applications successfully you’ll need to setup the JAVA_HOME and PATH environment variables. 00:01:20 Download Java JDK from official website of OracleĠ0:03:45 Open cmd and check if Path and JAVA_HOME are setĠ0:06:47 Create JAVA_HOME Environment VariableĠ0:07:35 Open cmd to verify Path and JAVA_HOME Environment Variable
