I'm trying to set my JAVA_HOME path to use my javac.exe?
Solution 1
cmd
is using the values from the PATH
variable to locate javac
:
set "PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_17\bin"
For other softwares (Tomcat, Maven, etc.) JAVA_HOME
must indicate the root of your JDK :
set "JAVA_HOME=C:\Program Files\Java\jdk1.7.0_17\"
No need to restart Windows. When using set
the changes are taken immediately.
If you choose to modify those variables in the Control Panel, you have to close and relaunch cmd
for the changes to take effect.
Solution 2
You have to add java
C:\Program Files\Java\jdk1.7.0_17\bin
Note that your path may be different.
to your environment variables and restart your console.
You can find how to set your variables here: http://www.itechtalk.com/thread3595.html
Solution 3
Set the JAVA_HOME Variable
Right-click the My Computer icon on your desktop and select Properties.
Click the Advanced system settings. Click the
Environment Variables button. Under System Variables, click New.
Enter the variable name as JAVA_HOME.
Enter the variable value as the installation path for the Java Development Kit(C:\Program Files\Java\jdk1.7.0_17).
Click OK.
Click Apply Changes.
You might need to restart windows.
Joseph Safwat
Updated on June 04, 2022Comments
-
Joseph Safwat almost 2 years
I'm on Windows 7 and I'm trying to set my
JAVA_HOME
path to use PhoneGap on android, when i create a project using the command line "cmd" it tells me that it can't find javac.exe? although i'm sure that I've set the variable righthere's my stuff:
Variable name: JAVA_HOME Variable value: C:\Progra~1\Java\jdk1.7.0_17\bin (I've also tried to use: C:\Progra~1\Java\jdk1.7.0_17\bin\javac.exe)
My javac.exe location on my laptop
C:\Program Files\Java\jdk1.7.0_17\bin\javac.exe
and it still tells me that it can't locate the
javac.exe
What I type to create the project and i meet this problem is this:
C:\Users\user>cd C:\Users\user\Desktop\phonegap-2.8.1\lib\android\bin C:\Users\user\Desktop\phonegap-2.8.1\lib\android\bin>create.bat Cannot locate javac.exe using the PATH environment variable. Retry after adding directory containing javac.exe to the PATH variable. Remember to open a new command window after updating the PATH variable. Visit http://java.oracle.com if you need to install Java (JDK).
Also, i've tries restarting the windows and closing the command prompt and redownloading the JDK.
Thank You.
-
Joseph Safwat almost 11 yearsshall i restart the windows? i tries and it still can't locate it.
-
Joseph Safwat almost 11 yearsShall I restart the windows? I tried and it still can't locate it
-
Rohit Jain almost 11 years@JosephSafwat. In PATH environment variable, add an entry - `%JAVA_HOME%\bin'. No need to restart windows.
-
JREN almost 11 yearsAre you 100% certain that you have the JDK installed and not the JRE? JDK = Java Development Kit and JRE = Java Runtime Environment. The JRE doesn't have a java compiler (javac.exe). You should download the JDK from the website again, install it in a different folder and check if javac.exe is in that /bin folder. Then point your environment variable to that folder.
-
Kevindra about 9 yearscmd uses PATH variable to locate javac. In my case, "java" command was working but javac was not. So I had to add java path in both "Path" and "JAVA_HOME" environment variables.