Javac not recognized as internal or external command

by admin on August 17, 2013

Javac is the executable for compiling java applications.   When compiling a java program from command line, this is the most common issue people face.  Let’s see how we can fix this issue.

  1.  First thing we need to compile java programs is to have JDK(Java development Kit) installed on your computer.  If you are not sure whether you have already installed it or not, you can verify from appwiz.cpl.(More details here –  How do I check if Java is installed on my system)
  2. Please note that having JRE is not enough to develop java applications. JRE only helps to run already built applications, we need JDK to compile Java code.

  3.  If java is installed, then you need to check if PATH environment variable points to the java executables directory.
    • Open command prompt
    • Run ‘set path’. This will print the current value of path environment variable. You can see the list of all the directories added. Check if  Java sdk path is added or not. If it’s added you should be able to see something like below.

      c:\>set path
      Path=C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Quarantine\;C:\Program Files\Perforce;C:\Program Files\Microsoft Network Monitor 3\;c:\Program Files\Java\jdk1.7.0_17\bin

    • If you don’t find JDK path you can add now. Please note that the path you need to add on your system would vary based on the SDK version you installed and also the location of the installation. Check the folder “C:\Program Files\java”   and  “c:\Program Files (x86)\java” to find the exact path.
    • You can modify PATH variable from command prompt or from GUI. For command line steps, please see  – Set path from windows command prompt
    • To modify PATH using GUI you can follow the steps below.

Add java SDK directories to PATH

  1. Open System properties (Run sysdm.cpl)
  2. Go to Advanced tab
  3. Click ‘Environment variables’

  4. Under ‘System Variables’ scroll down to find PATH. Edit the entry and add JDK path.

  5. Click OK and close the windows.

Now open new command prompt and run ‘set path’, you can see that JDK path is added.  Note that if you run the command from a window which was opened before you modified the PATH variable, it would not print updated path. Even for compiling java programs, you need to open a new command window after setting PATH.

{ 15 comments… read them below or add one }

Shan August 26, 2013 at 6:48 am

I was getting this error “‘java’ is not recognized as an internal or external command..”. Thanks for the detailed information on how to fix this.


sruthi April 3, 2014 at 5:22 pm

This is really helpful to run java in my pc,, Thanks a lot for sharing this information..


Prognoey July 6, 2014 at 2:38 am

Thank you.Step by step teaching is very useful. I spent more than 2 hours to solve this problem and finally this forum help me. Thanks again.


dakota August 29, 2014 at 1:21 am

it still is popping up that error message for me? any idea whats wrong?


admin October 14, 2014 at 5:52 am

You need to open a new cmd window after setting the path.

Camille September 6, 2014 at 9:04 pm

worked for me. THANK YOU! look into the already existing Path variable and simply add the Java bin extension after a semi colon…


Mich October 14, 2014 at 5:25 am

Thanks! Done well. I just didn’t understand the procedure in the book but after reading your steps “clap, clap. clap” God bless! ^_^


Riko Takano November 13, 2014 at 1:47 am

Thank you so much sir :))


apurva December 18, 2014 at 5:40 pm

i have java installed on my computer i verified it.but when i type javac then it is showing above error even after setting path….what should i do?plz help


admin December 19, 2014 at 3:01 am

I am not sure if you have also verified JDK was installed and not just JRE. can you confirm this?
Also, did you open a new cmd after setting the path?

Devika January 20, 2015 at 7:13 pm


I have installed jdk 8 update 25,and also set the path and rebooted system.But still its showing message like java is not recognized as an internal /external command

Request your help

Thanks in advance


admin January 20, 2015 at 7:38 pm

Can you let us know the following to help you.
1)The path of the folder where your java bin folder is located.
2)The value of PATH environment variable(you can get using ‘set path’ command)

Reboot is not required to make PATH changes effective. Just a new cmd window should get new values.

Mehmet January 25, 2015 at 2:41 pm

Hı, after those steps, it compiled the java files but I get Could not find or load main class error .


needy February 18, 2015 at 5:54 pm

thanks a lot buddy.


mohammad March 18, 2015 at 7:30 am

Thank you…its Helpfull


Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: