Javac is not recognized - Quick Fix



If you're a Java developer or user, you may have encountered the error message "java is not recognized as an internal or external command, operable program or batch file." This error typically occurs when you try to run a Java program or command in the command prompt or terminal, but the system cannot find the Java executable file. In this article, we will explore the possible causes of this error and provide solutions to help you fix it.



Possible Causes of the Error



Java not installed: This is the most common cause of the error message. If Java is not installed on your system, the system cannot find the Java executable file to run the command or program.

Java not added to system PATH: If Java is installed on your system, but the system cannot find the Java executable file, it could be because the Java bin directory is not added to the system PATH.

Incorrect Java version: If you have multiple versions of Java installed on your system, and the wrong version is set as the default version, the system may not be able to find the Java executable file.



Step By Step Procedure to Reproduce java is not recognized error



There could be many possibilities behind Java in not recognized error, here are the steps you can try to reproduce.

  1. On windows, Click on Start, then type cmd, and hit Enter. You will now get a command prompt screen. Type "java" or "java -version and enter", you will get Java is not recognized as an internal or external command, operable program or batch file error. This happens if the Installed java in not set properly.
  2. C:\Users\Techoral> java
    'java' is not recognized as an internal or external command, operable program or batch file.

  3. Your can also try to Run javac command to compile a java program from command line, you will get Javac is not recognized as an internal or external command ERROR if the installed java is not being set properly.
  4. C:\Users\Techoral> javac 'javac' is not recognized as an internal or external command, operable program or batch file.






# Resolving Java is not recognized as an internal or external command issue



Here are the steps to reslove the error:

More details about this Bug in OpenJDK -



If the above steps didn't resolve this issue, please refer OpenJDK Bug for details.

 Description   
ADDITIONAL SYSTEM INFORMATION :
Windows 7 Professional Service Pack 1 64 bit JDK 11

A DESCRIPTION OF THE PROBLEM :
I have installed jdk 11 on windows 7 machine and have given JAVA_HOME in system variables. After that also java not recognized in my command prompt.

REGRESSION : Last worked in version 8u172

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
I have installed jdk 11 on windows 7 machine and have given JAVA_HOME in system variables. After that also java not recognized in my command prompt.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
on entering java -version it should return java version.
ACTUAL -
'java' is not recognized as an internal or external command

FREQUENCY : always




 Comments   
Comment by Priyanka Mangal (Inactive) [ 2018-09-12 ]
Submitter replied:
"yeah after adding bin to path it is working. In earlier version i never used to provide."

Closing this as Not an issue.


please refer bug at Java is not recognized as an internal or external command More about this bug @ OpenJDK Java error code 1603



Read Next :