W3docs

How do I find where JDK is installed on my windows machine?

To find where the JDK is installed on your Windows machine, you can follow these steps:<br>

To find where the JDK is installed on your Windows machine, you can follow these steps:

  1. Open the Start menu and search for "Environment Variables".
  2. Click on the "Edit the system environment variables" button.
  3. Click on the "Environment Variables" button.
  4. In the "System Variables" section, scroll down and look for the JAVA_HOME variable. Note: This variable is not always set by default. If it is missing, you may need to create it manually and set its value to your JDK installation directory.
  5. The value of the JAVA_HOME variable is the path to the JDK installation directory.

Alternatively, you can use the where command to find the location of the java executable:

  1. Open a Command Prompt window.

  2. Type the following command and press Enter:

    where java

This will print the path to the java executable found in your system PATH. Note that if the JDK bin directory is not in your PATH, this command may return a path to a JRE or a different JDK installation instead.

For a modern alternative, you can use PowerShell:

Get-Command java | Select-Object -ExpandProperty Source

Note that the JDK installation directory may be different from the JRE installation directory. The JDK includes the JRE and additional development tools, such as the javac compiler and the javadoc documentation generator.