0

I get the following error when I try to build my Android App :

Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "C:\Program Files (x86)\Java\jre7"

But the system environment variable JAVA_HOME is actually set to "C:\Program Files\Java\jdk1.7.0_25"

We have here two different values for JAVA_HOME.

Where does this conflict come from ?

Cherif
  • 5,223
  • 8
  • 33
  • 54
  • duplicate of http://stackoverflow.com/questions/4613046/setting-java-home-at-android-sdk ? – Ankit Jul 18 '13 at 21:00
  • it has answers with much up votes. possibly OP forgot to accept. – Ankit Jul 18 '13 at 21:04
  • The answer with 6 votes is what I did before thinking of posting this question. My question is more accurate : where does the value read by the SDK come from ? – Cherif Jul 18 '13 at 21:07
  • tried setting JDK path as java_home ? – Ankit Jul 18 '13 at 21:37
  • How are you building your app (eclipse/ant script/whatever) such the JAVA_HOME doesn't point to the correct location? – Morrison Chang Jul 18 '13 at 21:38
  • I am packaging a Sencha-Touch-web-app for Android with Sencha Cmd. Within a terminal I launch the Sencha Cmd build command. – Cherif Jul 19 '13 at 12:25

2 Answers2

1

To permanently set your JAVA_HOME Environment Variable under Windows to the JDK directory you've mentioned do the following:

Click Start, right click on Computer and select properties (you can also hold down the windows key and press the pause/break key).
Click on Advanced system settings on the left.
Click the Environment Variables button on the bottom.
Click the New... button below the System variables window.

Enter the following:

    Variable name: JAVA_HOME
    Variable value: C:\jdk1.6.0_23\ 

Click Ok, Ok, Ok, and close the system control panel you opened in step 1
Close and re-open your command prompt.

If you are using Eclipse then skip the steps above and do the following:

Click on the Window menu and choose Preferences.
Expand the Ant entry on the left and click on Runtime
Click on Global Entries in the Classpath tab on the right.
Click Add External JARs...
Navigate to C:\jdk1.6.0_23\lib and select tools.jar then click open.
Hit ok to Close the preferences Window.

In your situation however your best bet would probably be to simply append C:\jdk1.6.0_23\bin to your PATH env var using my first set of instructions above as a rough guideline.

Ankit
  • 6,554
  • 6
  • 49
  • 71
0

You can set envirnment variables by right clicking on my computer then Advanced System Settings. You should see Envirnment Variables button click on it and add the location to the JDK. I noticed your currently pointing it to the JRE.

Ben P. Dorsi-Todaro
  • 221
  • 1
  • 6
  • 20
  • The JAVA_HOME on the system is actually pointing to the JDK, with the right path. I don't know where does the SDK get the JAVA_HOME wrong value from. That is the problem. – Cherif Jul 18 '13 at 21:10