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?
Make sure that the javac
is in the OS's search path
For example, on Windows, goto Control Panel
-> System
, click Advanced System Settings
, click on Environment Variables
.
In the System variables
, locate the variable named path
and insert C:\Program Files\Java\jdk1.7.0_25\bin
at the start of the value
. 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.
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 option Edit the system environment variables
on Windows 7
5) clicked on Environment Variables
in the System Properties tab that should have opened.
6) with PATH
highlighted, clicked Edit...
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.
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.
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 case javac
is getting picked up in the wrong directory because the wrong directory happens to be first.