1. Overview

As Java developers, we sometimes get into an issue that says 'Java is not recognized' as shown below.

Error: Java is not recognized as an internal or external command, operable program, or batch file.

In this article, let's look at how we can resolve this issue in a few simple steps.

2. Content

2.1. What is the error?

The error message says that the Java is not recognized, which looks like the one below.

2.2. When do we get into this issue?

We get this issue in two situations

  • Java is not installed or
  • Java "bin" directory location is not included in the "Path" environment variable

And, this issue will not allow us to run any Java commands including compilation and execution of Java programs.

2.3. If Java is not installed, and getting this error

We need to install Java from their official website mentioned below.

Link to Java Official Website

If you want to know how to install Java on Windows, do check our other article mentioned below.

2.4. If Java is installed, and still getting this error

We need to include the Java "bin" directory in the "Path" environment variable.

We need this as the system must know the location of Java executables, which reside in the "bin" directory as shown below.

Check the below articles to know why and how to set up the Path variable.

3. Conclusion

We should be able to easily resolve the "Java Not Recognized" issue on Windows.