Explain Codes LogoExplain Codes Logo

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

java
java-home
jdk-installation
windows
Alex KataevbyAlex Kataev·Jan 14, 2025
TLDR

Quickly find the JDK on Windows using the command prompt:

Inspect the JAVA_HOME environment variable:

echo %JAVA_HOME%

Show the path of the java executable:

where java

Typical installation directories:

  • For 64-bit JDK:
C:\Program Files\Java\jdk-<version>
  • For 32-bit JDK on a 64-bit system:
C:\Program Files (x86)\Java\jdk-<version>

Replace <version> with your installed JDK version.

Dealing with unconventional installs

What if JAVA_HOME isn't set, or the install path is non-standard? Here are some remedies:

Locate javac using where:

where javac

This command finds the javac.exe in the JDK directory & returns its location.

Manually search: Navigate to C:\Program Files\Java\ or C:\Program Files (x86)\Java\ and look for directories prefixed with 'jdk'.

Check both "Program Files" directories: On 64-bit systems, JDK can be in Program Files or Program Files (x86), depending on whether you installed the 64-bit or 32-bit JDK.

Check the folder structure: An established JDK directory has specific subfolders. Confirm it possesses bin, lib, and others.

Detailed guide on navigating JDK detection problems

Java Control Panel: Windows offers a GUI-based Java Control Panel for managing Java versions and finding JDK location:

  • Find the Control Panel -> Java
  • Under the Java tab, manage your Java runtime installations.

Deeper with Command Line: Beyond where, one can use the cmd for more information:

for %i in (java.exe) do @echo. %~$PATH:i

This command searches your PATH for java.exe, outputting its location. Use this navigation guide to find the JDK's hideout.

Remember the difference between JDK and JRE: Ensure you're viewing the JDK, not the JRE. JDK contains tools like javac, while JRE does not. Also, setting JAVA_HOME is crucial for many development tools, even if it's not necessary for running Java applications.

For macOS or Unix-based systems: Not a Windows scenario, but on Unix-based systems like macOS, you can find the installation using symbolic links:

ls -l /usr/bin/java