I'm following a play tutorial when I run the web server before making any changes to the app. The server throws an error:
IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
I check my JAVA_HOME and it reads C:\Program Files\Java\jdk1.7.0_25. How would one fix this issue?
Even though you might have the JDK bin directory in your
PATH
environment variable, this problem can occur. To fix it, put the path of JDK bin directory (not the JRE one) at the beginning of the PATH variable, just in casejavac
is getting picked up in the wrong directory because the wrong directory happens to be first.Make sure that the
javac
is in the OS's search pathFor example, on Windows, goto
Control Panel
->System
, clickAdvanced System Settings
, click onEnvironment Variables
.In the
System variables
, locate the variable namedpath
and insertC:\Program Files\Java\jdk1.7.0_25\bin
at the start of thevalue
. Don't forget to add;
between the values ;)Click
Okay
,Okay
.Close any command prompt windows you have open and re-open them. This will ensure that they are updated with the new environment variables.
Don't forget to check your system access. You should have all access power during the instalation or setting process. I just had to require full OS access (Windows, in the big company) to solve this issue and now it's all ok.
I wasn't aware that the typical java install DOES NOT have
javac
. Thus, I did the following:1) Visited the Java SE Development Kit site
2) Downloaded the version for my Operating System and installed it
3) went to the root folder of the newly Java SE Development Kit (in this case
C:\Program Files (x86)\Java\jdk1.8.0_31\bin
)4)Using the windows search, entered
environment variables
, which brings up the optionEdit the system environment variables
on Windows 75) clicked on
Environment Variables
in the System Properties tab that should have opened.6) with
PATH
highlighted, clickedEdit...
7) Added
;
(a semi-colon to seperate this new path from the old) +C:\Program Files (x86)\Java\jdk1.8.0_31\bin
(make sure there is no space between the semi-colon and the new path.