≡ Menu

Javac not recognized as internal or external command

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)

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.

  1.  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.
    • If you already have PATH set with the java location, check one more time if you have added path till the bin folder. So adding c:\Program Files\Java\jdk1.7.0_17 is not correct. You need to add c:\Program Files\Java\jdk1.7.0_17\bin.
    • 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.

How to set JDK 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.

{ 50 comments… add one }
  • Shan August 26, 2013, 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, 5:22 pm

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

  • Prognoey July 6, 2014, 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, 1:21 am

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

    • admin October 14, 2014, 5:52 am

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

  • Camille September 6, 2014, 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, 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, 1:47 am

    Thank you so much sir :))

  • apurva December 18, 2014, 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, 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, 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, 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, 2:41 pm

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

  • Sabata April 1, 2015, 10:24 am

    Thanks a lot man..I can now compile java source file…you are the man…chess

  • Rhys April 12, 2015, 4:23 pm

    Here’s a weird one: My javac works just fine but -jar isn’t recognized. Path variable definitely contains my JDK path. What can I do?

    • admin May 9, 2015, 5:48 am

      Make sure you have jar.exe executable in the JDK path. This should have been installed by default in the same folder where javac.exe is present.

  • Alolita April 22, 2015, 2:40 pm

    Please I need your help, how to retrieve information after pressing deleting button? I deleted the “Path” and it’s value from the environment. Actually, I wanted to set the path for javac, I don’t know what information should I enter now into the path, but I have added the name of the jdk and it version to it, so now the path is lost together with the the values or whatever that was written in there before I edited it.

    please, can anyone help me? please I need your help in how to solve the problem like this “javac not recognized as internal or external command”

    your help is much appreciated!

    Thank you!

    • admin April 23, 2015, 4:42 pm

      You can set it again, that should not be a problem. The value I have on my system is this.

      C:\>set path
      Path=C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.
      0\;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Quarantine\

      From the above, you can remove the folders not existing on your system and set PATH accordingly.

  • Bryan April 29, 2015, 12:56 pm

    I have installed jdk 8 update 45, and set the system environment path. I made sure that my command prompt window was closed and then open the command prompt window and I still getting the ‘javac’ is not recognized as an internal /external command.

    1)The path of the folder where your java bin folder is located.
    C:\Program Files\Java\jdk1.8.0_45
    The patch C:\Program Files\Java has the following folders

    2)The value of PATH environment variable(you can get using ‘set path’ command)
    C:\ProgramData\Oracle\Java\javapath;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Java\jdk1.8.0_45

    Thanks in advance

    • admin April 29, 2015, 6:57 pm

      there’s minor error in the java path you were using. You need to add C:\Program Files\Java\jdk1.8.0_45\bin. bin was missing in the path you have.

  • jeanc May 22, 2015, 4:49 pm

    Thanks a lot. it worked

  • Matt June 3, 2015, 8:57 pm

    I’ve read through your guide and the comments and am still having an issue. Any help would be vastly appreciated; I’ve put hours into this already.

    1) PATH : “C:\Program Files\Java\jdk1.8.0_45\bin”

    2) I have closed and reopened cmd.

    • admin June 3, 2015, 9:28 pm

      Let us know output of this dir "C:\Program Files\Java\jdk1.8.0_45\bin"
      PATH seem to have been set correctly. But I doubt if you have java*.exe files in the folder or not.

  • Aryan June 15, 2015, 9:41 am

    Thankx , I was getting this error from the last 2 months and now finally i have resolved it……:-)

  • rohan June 19, 2015, 4:25 pm

    after following all the above steps, i am able to complile and run succesfully all the codes that are saved in my bin folder.

    but if i save my .java files in some other folder, and try to compile them, then i got the ”javac is not recognized as intrnl or extrnl comnd..” error.

    what should i do to run my codes from any folder?

    • admin June 19, 2015, 9:53 pm

      Looks like you did not set value in PATH/did not set the right value. Please see the instructions above for setting PATH correctly.

  • Anna June 24, 2015, 5:29 pm

    Hi. It still won’t work for me, is says Javac not recognized as internal or external command still.. I’ve reopended the cmd-window and don’t know what’s wrong. I thought I could answer the same questions someone else got, maybe you could see whats wrong or have another idea of what I can do.

    1)The path of the folder where your java bin folder is located.
    C:\Program Files (x86)\Java\jdk1.8.0_40\bin
    The patch C:\Program Files (x86)\Java has the following folders

    2)The value of PATH environment variable(you can get using ‘set path’ command)
    Path=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:\Program Files (x86)\Java\jdk1.8.0_40\bin

    • admin June 24, 2015, 11:21 pm

      Can you check if you have javac file in the bin folder. Though it’s unlikely that the file won’t be present, but I don’t see any other reason why you still get the error.

    • shivani July 9, 2015, 9:35 am

      hi admin,
      I am also facing the same problem. I don’t have javac file in the bin folder.
      Can u please help.

    • admin July 9, 2015, 6:16 pm

      Check if you have installed JDK or JRE? JDK should have javac.exe executable along with other JRE stuff. JRE would have only the files(java.exe and few more)to run already compiled java programs.

    • kalyan March 20, 2016, 3:57 am

      While setting the path I erased the previous path already existing,I entered “c:\programfiles(x86)\java\jdk\1.8.0_65\bin;” in cmd prompt set path command shows the path value which is same as above still i get the error javac is not recognized……pls help.

    • Megha January 17, 2016, 11:57 am

      I got the same problem like this. I checked javac in bin folder and it was there. But I caught different problem. I set the path in cmd and when I checked it was set. Then I close the window and when I reopen another cmd window path was not there that I set in the previous cmd window. Can you please help?

  • Lakshith June 27, 2015, 6:18 am

    Thank you very much for the instructions. I fixed that recognizing error.

  • pranjal July 12, 2015, 3:06 pm

    still not working buddy! please help

  • Aangi July 18, 2015, 1:33 pm

    me facing same problem as Shivani and Anna face… but I have javac.exe in bin folder but still getting the error

    Javac not recognized as internal or external command !! please help

  • Jeptha August 9, 2015, 2:38 am

    Set Path:

    C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static\;C:\Program Files\Java\Jdk.1.8.0_51\bin

    Already set the path. There’s a java.exe in the folder still get an error. PLEASE HELP! :3

  • Madhuri Nallamilli August 27, 2015, 3:00 pm

    Even after setting the path I’m getting the error javac is not recognized as internal or external command.Please anyone help me out with this. Recently I’ve changed my os to windows10.

  • khushboo chauhan September 22, 2015, 1:24 pm

    I have installed java SE 8 update 6 .
    The path I have set is : C:\Program Files (x86)\Java\jdk1.8.0_60\bin
    the location of java is :C:\Program Files (x86)\Java\jdk1.8.0_60 (for jdk it also contains javac file in bin folder) and
    C:\Program Files (x86)\Java\jre1.8.0_60 (for jre)
    I am trying to run program which is located in some folder of D drive.. When I am trying to run I am getting the error that “javac is not recognized as internal or external command. ” The same thing was working fine with java 7 …

  • arwa October 1, 2015, 5:57 am

    Thank you so much, that works for me.
    I found the problem that I didn’t put space between program Files ,
    That took three day,
    Thanks again for your help

  • jarjan November 3, 2015, 6:21 pm

    Thank you so much, that worked for me!

  • Su November 8, 2015, 1:34 pm

    Thanks a lot. I was doing everything right but still was not able to see jdk path in command prompt. Your last Note made my day. Reopening a new command window solved my problem.

    Thanks a ton.

  • Zaynab December 4, 2015, 5:50 pm

    Thank-You so much for this helpful information. Stay blessed :)

  • nirja December 11, 2015, 9:31 am

    thanks to this article , it helped me a lot

  • tal January 28, 2016, 2:37 pm

    thanks a lot it really helped …

  • Mohammad shekhu February 14, 2016, 3:08 pm

    After the path correctly..still the progarm isn’t compiling..help me out..

  • junaid March 5, 2016, 10:52 am

    inspite setting the path i am able to run java but m unable to run javac
    i have followed all the procedure

  • shubham March 7, 2016, 6:32 am

    still geting same error on compiling that “javac is not recognised as an internel or externel command”

  • Shahroz April 22, 2016, 10:19 pm

    Thank you! It worked! I added path through GUI but I was checking again and again in the same command prompt. Once I opened up a new one I found the new path added by doing ‘set path’ and javac worked! (Y)

  • Kundan April 26, 2016, 1:31 pm

    To run javac in cmd, you use ‘set PATH’ which is right, but there is a problem in this way.

    “You have to set path every time you start cmd.”

    I have found a new and very easy way which have to be done only for one time.

    Please read the instructions carefully –

    .Firstly, Open Drive “C:” > Open Windows > Open Java.
    .Now, You will face two folders of jdk.
    .You have to open first folder and then open Bin.
    .Press ctrl + A and then ctrl + C.
    .Go back to C: Drive and then Windows.
    .Then press ctrl + V.
    .Now go back to C: > Program Files > Java > JDK[First Folder].
    .Press ctrl + A and then all files and folders will be selected.
    .Deselect the file – bin.
    .Press ctrl + c and paste all the files in C: Drive. (Keep in mind that the .pasted files should not be in any of the folders, it will be outside all the folders and should only be inside the C: Drive.

    • Srini April 27, 2016, 1:46 pm

      No, you do NOT need to set path every time. Follow the instructions in the post to do it from system properties window. You need to set path only once and it works fine from thereafter. Make sure that you open new command prompt after you updated the path.

Leave a Comment