Javac is not recognized as an internal or external command, operable program or batch file


This error “javac is not recognized as an internal or external command” may occurs when the java compiler (javac.exe) path is not set properly
As, we all know that we can set path of javac.exe in two ways:
•Temporary
•Permanent
But, I have seen that you set the path of javac.exe temporarily using the “set path” command. So you wrote something like this



C:\Users\Ivy>cd \

C:\cd java files

C:\java files>set path=C:Program Files (x86)\Java\jdk1.7.0\bin

C:\java files>javac Hello.java


You are getting an error [ 'javac' is not recognized as an internal or external command, operable program or batch file] due to missing backslash(\) before Program Files(x86) in the third line or statement of the above code.

So please correct the third statement “set path=C:\Program Files (x86)\Java\jdk1.7.0\bin” instead of “set path=C:Program Files (x86)\Java\jdk1.7.0\bin”.

Now, the javac.exe path is set temporary successfully and you can compile and execute your program.

Note: The error you were getting just because of “\” missing in path statement before Program Files(x86).

Correct Code:



C:\Users\Ivy>cd \

C:\cd java files

C:\java files>set path=C:\Program Files (x86)\Java\jdk1.7.0\bin

C:\java files>javac Hello.java



Disclosure: This article may contain affiliate links. When you purchase, we may earn a small commission.

Hello guys, if you are trying to compile your Java source file and getting "'javac' is not recognized as an internal or external command" in Windows or Linux machine like Windows 10 or Redhat 8 but not sure what to do then you have come to the right place. This is a common Java related error and can occur to an operating system like Windows, Mac or Linux if java is not installed properly like only JRE is installed and JDK is not installed or javac is not added on PATH environment variable. In this article, I will explain what this error is and how you can fix it by following step by step guide I share, but if you still cannot solve this problem on your own then just ask for help in comments. But don't forget to check your PATH environment variable because that's where JDK/bin directory needs to be present, which contains all Java related commands including "javac" and "java" which are used to compile and run Java applications.

If this is your first Java program or HelloWorld then I suggest going through How to compile and run HelloWorld in Java because that explains what do you need before you compile and run any Java program. 

If you have already crossed that level and knows about How to set PATH in Java then there is something wrong while setting PATH in Java. Anyway let's see when do you get this error and from where does 'javac' is not recognized as an internal or external command comes.

This is a standard error in the Windows command line and Linux when you type a command which is not available in System PATH, here javac command which is used to compile Java source file and produces class files are not in PATH. Best way to verify this is by executing the following command :

# echo %PATH%

If you see your JDK installation folder or JAVA_HOME in PATH and included bin directory which contains all java binaries including javac and java commands which are used to compile and run Java program. 

Most likely your PATH may not have JDK/bin in PATH if that's the case just include the bin folder of JDK in your PATH. See how to set PATH for Java in Windows for step by step guide.

Cause of 'javac' is not recognized as an internal or external command in Windows 10 and Linux

Another cause of  " javac is not recognized as an internal or external command " could be that you only have JRE in your System and not JDK, which means you can only run already compiled Java programs and can not compile Java programs because JRE doesn't contain javac in their bin folder. To know more about JRE and JDK, see the difference between JRE and JDK. In this case, you need to download and install Java in your System. You can download the current version of Java from Oracle's site.

Another possible reason for " javac is not recognized as an internal or external command "  is setting PATH with an incorrect directory e.g. path may not contain forward slash or missed something. 

Here is how this error looks like in Windows command prompt

Javac is not recognized as an internal or external command, operable program or batch file

The best way to verify this is just to copy the path of JDK from the PATH variable and execute in the command line if you can not get into that directory which means the path to the JDK installation folder is incorrect. 

In this case, go to the bin directory of the JDK installation directory and copy its address from the address bar and add it into PATH to make this work.

Javac is not recognized as an internal or external command, operable program or batch file
So the root cause of  "javac is not recognized as an internal or external command " is that system is not able to find the javac command from its PATH. just double check PATH and add the bin folder of the JDK installation directory in the path, if not included already. Remember to close and reopen the command prompt once you make this change, this will fix the " javac is not recognized as an internal or external command " error.

That's all about how to fix this "javac is not recognized as an internal or external command " error in any operating system from Windows to Mac. Just follow the steps as its PATH related issue which is general concept across all the operating system. 

You should also see if you have declared JAVA_HOME environment variable which points to JDK installation directory. It's a common practice that many people add JAVA_HOME/bin into PATH but they forget to declare JAVA_HOME environment variable, in that case entry in PATH becomes invalid and System not able to find the javac or other java related command. 

If you see JAVA_HOME in your PATH then please make sure that JAVA_HOME is declared properly and point to right JDK installation to avoid this and other Java Path related issues.

Other Java tutorials for Beginners

How do you fix this error javac is not recognized as an internal or external command operable program or batch file?

It means that the javac.exe executable file, which exists in the bin directory of the JDK installation folder is not added to the PATH environment variable. You need to add the JAVA_HOME/bin folder in your machine's PATH to solve this error.

How do you fix javac is not recognized Windows 10?

Set the PATH Temporary.
Open the Command Prompt..
Go to the directory where you have installed the JDK. Inside the JDK folder search the bin folder and open it..
Copy the location of the bin folder. In our case, the location of the bin folder is: C:\Program Files\Java\jdk1. 8.0_05\bin..

What should I do if javac is not recognized in CMD?

Your answer.
Check your javac path on Windows using Windows Explorer C:\Program Files\Java\jdk1. 7.0_02\bin and copy the address..
Go to Control Panel. Environment Variables and Insert the address at the beginning of var. ... .
Close your command prompt and reopen it,and write the code for compile and execution..