Joseph Safwat
Joseph Safwat

Reputation: 21

I'm trying to set my JAVA_HOME path to use my javac.exe?

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 right

here'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.

Upvotes: 2

Views: 15505

Answers (6)

Hito_kun
Hito_kun

Reputation: 992

May be a little old, but since this is the first goolge result, I might as well add a little something.

You need to create the JAVA_HOME variable AND edit the PATH variable, adding ;%JAVA_HOME%\bin (with a ;) so cmd and some other apps can actually use javac and the rest of the tools

Upvotes: 0

gaepi
gaepi

Reputation: 404

I already had this error when I tried to create a new phonegap project for android but unfortunately I don't remember how exactly I have fixed this.

I don't know if you have followed the phonegap documentation so here is the link : new project, especially the part 3B (be careful about ; in your PATH). If you don't know what to do now, maybe you should do it again step by step.

Upvotes: 0

Raphaël
Raphaël

Reputation: 3751

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.

Upvotes: 4

Ruchira Gayan Ranaweera
Ruchira Gayan Ranaweera

Reputation: 35577

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.

Upvotes: 1

Reimeus
Reimeus

Reputation: 159844

Set the JAVA_HOME environmental variable to

C:\Program Files\Java\jdk1.7.0_17

Press

Win + Break > Advanced System Settings > Environment Variables > System Variables

Modify/set JAVA_HOME to the above. (No need to restart)

Upvotes: 0

JREN
JREN

Reputation: 3630

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

Upvotes: 1

Related Questions