Find JDK Path in Windows: Quick Guide for Developers
In this article
The most reliable way to find the Java Development Kit (JDK) path on Windows is to open the Command Prompt and type where java. This command returns the exact file system location of the executable currently used by your system. If you need the installation directory rather than just the executable path, check the JAVA_HOME environment variable or look in the standard C:\Program Files\Java folder.
What You'll Need
- A Windows PC with an installed JDK or JRE
- Access to Command Prompt or PowerShell
- Administrative privileges (only if setting environment variables)
Step-by-Step
- Use the Command Prompt to locate the active JDK: Press the Windows Key, type
cmd, and press Enter. In the black window that appears, typewhere javaand hit Enter. The output will show one or more paths. The top path is usually the one being executed. Note this path; it points directly to thejava.exefile. To find the root installation folder, go up two directories frombin(e.g., if the path ends in\bin\java.exe, the JDK home is the parent ofbin). - Check the JAVA_HOME Environment Variable: Many development tools rely on a system variable named
JAVA_HOME. To see if it is set correctly, stay in the Command Prompt and typeecho %JAVA_HOME%. If it returns a path likeC:\Program Files\Java\jdk-17, that is your official JDK path. If it returns%JAVA_HOME%literally or nothing, the variable is either unset or misconfigured. This method is preferred for configuring IDEs like IntelliJ IDEA or Eclipse. - Manually browse the default installation directory: If the commands above fail, the JDK might be installed in a non-standard location or not added to your system PATH. Open File Explorer and navigate to
C:\Program Files\Java. Look for folders namedjdk-xx(where xx is the version number). Inside, you should see subfolders likebin,lib, andinclude. The path to the folder containing these subfolders is your JDK path. - Verify the installation via PowerShell: For a more detailed view, open PowerShell (search for it in the Start menu). Type
$env:JAVA_HOMEand press Enter. This displays the current user or system-level JAVA_HOME value. Additionally, typingjava -versionconfirms that the JDK found at the path is functional and tells you which version is active. - Set the JAVA_HOME variable if missing: If you have located your JDK manually but
echo %JAVA_HOME%returned nothing, you must set it. Right-click the Start button, select System, then click Advanced System Settings. Click the Environment Variables button. Under System variables, click New. Set the variable name toJAVA_HOMEand the variable value to the path you found in Step 3 (e.g.,C:\Program Files\Java\jdk-17). Click OK to save. You may need to restart your terminal or IDE for changes to take effect.
Common Mistakes
One frequent error is confusing the JRE (Java Runtime Environment) with the JDK. The JRE only runs Java applications, while the JDK includes tools needed to compile code. If you are a developer, ensure you are pointing to a folder named jdk, not jre. Another common mistake is including trailing slashes in the JAVA_HOME variable. Windows handles paths better without them, so avoid ending your path with a backslash (\). Additionally, users often forget that changing environment variables requires restarting any open Command Prompt windows or integrated development environments (IDEs) for the changes to register.
Tips
Always verify your path by running javac -version after setting JAVA_HOME. This ensures the compiler is accessible, not just the runtime. If you manage multiple Java versions, consider using SDKMAN! (on WSL) or a version manager to switch paths easily. When copying paths from File Explorer, right-click the address bar and select "Copy as path" to get the exact string with quotes if necessary, preventing syntax errors in scripts.
Troubleshooting
If where java returns no results, Java is likely not in your system PATH. You can add it manually by editing the Path system variable and adding the bin directory of your JDK. If echo %JAVA_HOME% shows a path but tools still complain, check for typos or incorrect case sensitivity in older systems. Ensure there are no spaces in the path unless properly quoted. If you recently uninstalled Java, residual registry keys might cause conflicts; a system reboot often clears temporary path caching issues. If you cannot find the JDK folder, search your entire C: drive for javac.exe using File Explorer's search bar to locate hidden installations.
Frequently Asked Questions
How do I find the JDK path if I didn't install it myself?
If you are unsure where it was installed, use the where java command in Command Prompt. This reveals the executable's location, allowing you to trace back to the installation root.
Can I have multiple JDKs installed at once?
Yes. You can install different versions in separate folders (e.g., jdk-11 and jdk-17). You simply change the JAVA_HOME variable or update your system PATH to point to the specific bin folder of the version you wish to use.
Why does my IDE say it cannot find the JDK?
This usually happens because the IDE does not automatically detect the JAVA_HOME variable. You must manually specify the JDK path in your IDE's settings under "Project Structure" or "Build, Execution, Deployment" > "JDK".
Is the JDK path the same as the JRE path?
No. The JDK contains the JRE plus development tools. The JDK path is typically higher in the directory tree. Pointing to the JRE path will allow you to run programs but not compile them.
What if the JDK is installed on a different drive?
The steps remain identical. Just ensure your JAVA_HOME variable reflects the correct drive letter (e.g., D:\Java\jdk-17) instead of C:.