Unable to resolve this error: "javac is not recognized as an internal or external command"

in Java
Java Tutorials
2 Answers to this question

It means that javac.exe executable file, which exists in the bin directory of JDK installation folder, is not yet added to the PATH environment variable. You need to add the JAVA_HOME/bin folder in your machine's PATH to solve this error. It is not possible to compile and run a Java program until you add Java into your system's PATH variable.Add the Path variable and you are good to go.


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

 

 

If you want to unleash your potential in this competitive field, please visit the Java Certification Training page for more information, where you can find the       and    Java Interview Questions FAQ's and answers    as well.

For more updates on the latest courses stay tuned to HKR Trainings.

To Top