- 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 your computer has it installed or not, you can verify from appwiz.cpl.(More details here – How do I check if Java is installed on my system) Note that having JRE is not enough to develop java applications. JRE only helps to run already built applications, JDK(which Javac is bundled into) is also needed if you are developing software in java.
- 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 addingc:\Program Files\Java\jdk1.7.0_17
is not correct. You need to addc:\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
- Open System properties (Run sysdm.cpl)
- Go to Advanced tab
- Click ‘Environment variables’
- Under ‘System Variables’ scroll down to find PATH. Edit the entry and add JDK path.
- 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.
-
on August 17, 2013
Javac not recognized as internal or external command
Javac is the utility for compiling java applications. When compiling a java program from command line, the most common issue people get into is “Javac is not recognized as internal or external command’. Let’s see how we can fix this issue.
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.
This is really helpful to run java in my pc,, Thanks a lot for sharing this information..
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.
it still is popping up that error message for me? any idea whats wrong?
You need to open a new cmd window after setting the path.
u have to add semi colon at the end of the path and try
c:\Program Files\Java\jdk1.7.0_17\bin;
worked for me. THANK YOU! look into the already existing Path variable and simply add the Java bin extension after a semi colon…
Thanks! Done well. I just didn’t understand the procedure in the book but after reading your steps “clap, clap. clap” God bless! ^_^
Thank you so much sir :))
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
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?
Make sure you are setting the system PATH and not user PATH. For some reason, I find user PATH not to be working.
Hi
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
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.
Hı, after those steps, it compiled the java files but I get Could not find or load main class error .
Thanks a lot man..I can now compile java source file…you are the man…chess
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?
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.
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!
You can set it again, that should not be a problem. The value I have on my system is this.
From the above, you can remove the folders not existing on your system and set PATH accordingly.
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
jkd1.8.0_45
jre1.8.0_31
jre1.8.0_45
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
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.Thanks a lot. it worked
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”
PATHEXT: “.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC”
2) I have closed and reopened cmd.
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.
Also, make sure you are setting the system PATH and not user PATH. For some reason, I find user PATH not to be working.
Hi I am currently having this problem but when I type the dir command of the path I created I get all the correct files there.
I don’t know what’s the problem and how do I fix it ?
Thankx , I was getting this error from the last 2 months and now finally i have resolved it……:-)
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?
Looks like you did not set value in PATH/did not set the right value. Please see the instructions above for setting PATH correctly.
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
jdk1.8.0_40
jre1.8.0_40
jre1.8.0_45
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
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
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.
hi admin,
I am also facing the same problem. I don’t have javac file in the bin folder.
Can u please help.
Thanks
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.
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.
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?
Thank you very much for the instructions. I fixed that recognizing error.
still not working buddy! please help
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
Set Path:
Already set the path. There’s a java.exe in the folder still get an error. PLEASE HELP! :3
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.
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 …
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
Thank you so much, that worked for me!
Hi,
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.
Thank-You so much for this helpful information. Stay blessed :)
thanks to this article , it helped me a lot
thanks a lot it really helped …
After the path correctly..still the progarm isn’t compiling..help me out..
inspite setting the path i am able to run java but m unable to run javac
i have followed all the procedure
still geting same error on compiling that “javac is not recognised as an internel or externel command”
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)
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.
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.
Can you please spot the error. I know my path has a bunch a crap in it but I’m trying to place the jdk version in the correct spot. Here is my path with no version listed (and yes, I have checked and I have version 8.1.0_91)
C:\ProgramData\Oracle\Java\javapath;C:\oraclexe\app\oracle\product\11.2.0\server\jdk1.8.0_91\bin;;\%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
What I’ve been trying to put and still not working:
C:\ProgramData\Oracle\Java\javapath;C:\oraclexe\app\oracle\product\11.2.0\server\jdk1.8.0_91\bin;;\%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
and this
C:\ProgramData\Oracle\Java\jdk1.8.0_91\javapath;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;\%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
Can you help, please?
I think this will work. It might be jacked up a little but luckily I am able to run java -version and javac with no errors. Thanks for a helpful page! :)
still getting ,javac is not recognised as internal or external command!!
Make sure you run the command line as administrator in Windows 7 and above
Hello, I have Hello.java and in c:\MyProject.
But the Command
c:\myProject>javac Hello.java
javac: file not found: Hello.java
Usage: javac
use -help for a list of possible options
Could u pl advise me what is wrong
Thanks
Javac path is correct, it’s complaining that Hello.java is not found. Check if you have this file in C:\myProject folder
I did it but when I open cmd after closing all tabs it showed again the same thing except jdk and when I opened environment variables again I found that the path I have written wasn’t there please help
I already have the directory set correctly, but in certain folders Java isn’t recognized as a command. I have 4 minecraft servers for different modpacks/versions, but only one works. Copying the .bat doesn’t work, but running the .jar still works and typing the command in the commandline in that directory gives a different error
thanx for the suggestion …it worked by changng the path..most of the PCs/Laptops arise an error due to change in PATH..better every one first check their path set in ur respective system
hi admin,
i hav installed jdk latest version , if i give java -version in cmd its recognizing but javac is not being recognized what might be the reason??
I have set the environment variables and when i type java in command prompt it works. But when i try to compile a .java file using javac command it doesn’t work and gives me error javac is not recognized as an internal or external command
Hey Guys,
Even I was having the same issue and I did following 2 things which finally worked for me:
1. In system variables (in Advanced tab) created a new variable ‘CLASSPATH’ with value ‘C:\Program Files\Java\jre-10\lib’
2. Closed current cmd prompt window (as it was still giving the same error), opened new cmd window where I got correct response for javac :)
Hope it helps.
Only one program is compiling correctly. The other ones are giving errors. Help me out please
it worked, you beautiful man
I already setup all those think before seeing this notes but still i am facing java is not recognised as an internal or external cammand what should i do next i installed latest one java jdk 14