Java JDK javac location.

‘javac’ is not recognized as an internal or external command

The ‘javac’ is not recognized as an internal or external command, operable program or batch file is a very common error when you first install Java JDK on Windows machines. Here is how you can fix it.

‘javac’ is not recognized as an internal or external command
CMD javac error message.

Find javac location

Find the location of your Java JDK install where javac resides. Typically it will be something similar to: C:\Program Files\Java\jdk-XX.X.X\bin. Copy the location path of the folder.

Java JDK javac location.
Java JDK javac location.

If you do not find the folder, search “javac” in your C drive and open the file location.

Solution 1: Update the system variable PATH from GUI

1) Type Environment on the Windows search and open Edit the system environment variables. This will open System Properties window.

Windows Search for Environment.
Windows Search for Environment.

2) Under Advanced tab, select Environment Variables…. This will open the Environment Variables window.

Windows System Properties
Windows System Properties

3) Highlight Path and select Edit… to open Edit environment variable window.

Windows Environment Variables
Windows Environment Variables

4) With Path selected, click Edit.. and the javac path you found in your computer.

Adding javac path.
Adding javac path in environment variable.

Solution 2: Update the system variable PATH from CMD

Open Windows Command Prompt (CMD) and enter the following an press Enter,
set PATH = %PATH%;”C:\Program Files\Java\jdk-XX.X.X\bin.

Please note you must replace C:\Program Files\Java\jdk-XX.X.X\bin with the path you found in your computer.