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 Java SDK 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.  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.

{ 8 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 :))


Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: