How to Fix Error: Javac Is Not Recognized on Windows 10

Sheeraz Gul Feb 02, 2024
How to Fix Error: Javac Is Not Recognized on Windows 10

This tutorial demonstrates how to solve the "javac is not recognized on windows 10" issue.

the javac Is Not Recognized on Windows 10

The error "javac is not recognized on windows 10" commonly occurs with beginners or Java programming. The javac is a command used to compile the java programs; it invokes the javac.exe application in the bin directory of JDK.

Whenever the error "javac is not recognized" occurs, the JVM cannot find the file javac.exe. Either the file has been deleted, or the Environment variable is not set for the JDK.

javac can be found in the C:\Program Files\Java\jdk-17.0.2\bin directory.

javac exe file location

If JVM cannot find the javac file, it will throw the "javac is not recognized on windows 10". See example:

'javac' is not recognized as an internal and external command.

This error occurs when the PATH environment variable is not set for Java. To solve this issue, we need to set the PATH variable, which the system will use to find the executable files.

As mentioned above, the javac is located at the path C:\Program Files\Java\jdk-17.0.2\bin. The version of JDK can change according to your version.

The following steps below sets the PATH environment variable on windows 10.

  1. Search Environment Variable in the Start menu.

  2. Open the Edit the system environment variable option, which will open the system properties with the Advanced Menu.

    Environment Variable Advanced

  3. Click on the Environment Variable option to open a new tab.

    Environment Variable Tab

  4. Now, in the System Variables, select Path and click edit.

    Path Variable

  5. Click new and paste the path C:\Program Files\Java\jdk-17.0.2\bin.

    Path Variable Set

  6. Click Ok, and the Path variable is set.

Once the Path variable is set, you can run the Javac command to compile the files successfully.

Author: Sheeraz Gul
Sheeraz Gul avatar Sheeraz Gul avatar

Sheeraz is a Doctorate fellow in Computer Science at Northwestern Polytechnical University, Xian, China. He has 7 years of Software Development experience in AI, Web, Database, and Desktop technologies. He writes tutorials in Java, PHP, Python, GoLang, R, etc., to help beginners learn the field of Computer Science.

LinkedIn Facebook

Related Article - Java Error