2013-07-18 38 views
0

我收到以下錯誤,當我嘗試建立我的Android應用程序:與Android SDK JAVA_HOME衝突

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

但是系統環境變量JAVA_HOME 實際上是設置爲「C:\ Program Files文件\的Java \ jdk1 .7.0_25「

我們在這裏有兩個不同的值 for JAVA_HOME。

此衝突從何而來?

+0

http://stackoverflow.com/questions/4613046/setting-java-home-at-android-sdk的副本? – Ankit

+0

還沒有得到回答 – Cherif

+0

它有很多贊成票的答案。可能OP忘了接受。 – Ankit

回答

1

要永久設置您的JAVA_HOME環境變量,在Windows下你所提到的JDK目錄執行以下操作:

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. 

如果您使用的是Eclipse,然後跳過上述步驟,執行以下操作:

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. 

在您的情況下,您最好的選擇可能是簡單地將C:\jdk1.6.0_23\bin添加到您的PATH env var中,並使用上述第一組指令作爲粗略指導。

+0

請回答問題 – Cherif

0

您可以通過右鍵單擊我的電腦然後單擊高級系統設置來設置環境變量。您應該看到Envirnment Variables按鈕,然後將其添加到JDK。我注意到你現在將它指向JRE。

+0

系統上的JAVA_HOME實際上是指向JDK的,路徑正確。我不知道SDK從哪裏得到錯誤的JAVA_HOME值。那就是問題所在。 – Cherif