0

当我尝试构建我的 Android 应用程序时出现以下错误:

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”

我们这里有两个不同的 JAVA_HOME 值。

这种冲突从何而来?

4

2 回答 2

1

要将 Windows 下的环境变量永久设置JAVA_HOME为您提到的 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

于 2013-07-18T21:05:52.690 回答
0

您可以通过右键单击我的计算机然后高级系统设置来设置环境变量。您应该看到 Envirnment Variables 按钮单击它并将位置添加到 JDK。我注意到您目前将其指向 JRE。

于 2013-07-18T21:07:44.913 回答