Error: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
Error while building project
Most probably, such kind of error occurs only ones for the first time whenevr you do the new installations of JDK, JDE etc. This errors comes when your JDE installation cannot locate the JDK installation, particularly \bin folder of JDK installation.
To sort out this error, just set the classpath so that other softwares can locate your JDK installation. On my machine, set the classpath as C:\Program Files\Java\jdk1.6.0_23\bin; Please note that you will need to provide the complete path to the \bin folder of your JDK installation. And then restart your machine. I hope this will sort out this error. That’s it.
How can I set a classpath variable?
Setting a classpath variable is very simple, just follow the steps below:
- Right-Click on My Computer
- Go to Properties
- It will open a window named as System Properties
- Click on Advanced tab
- Click on a button Environment Variables which you will find at the bottom of the window.
- It will open an another window named as Environment Variables with two sections, one is User variables for Administrator, and another one is System variables.
- In the System Variables section, scroll to find the variable Path and select it.
- Now click the Edit button.
- It will open an another small window named as Edit System Variables, with Path as a Variable name and a long string consisting of various path as Variable value. NOTE: Please don’t delete the existing paths.
- Then add the complete path e.g. C:\Program Files\Java\jdk1.6.0_23\bin; at the end of the existing path in the Variable value field.
- Press OK on each window.
- Restart your machine. That’s it!