《安卓创造》在 Windows 7 中调用失败 - 缺少 JDK
我在 Windows 7 中设置我的 android 开发环境时遇到问题.我按照说明操作 这里, 以及几个环境子链接.我正在使用带有 Android 插件的 Eclipse.我已经在不同的位置(jdk-6u20-windows-i586.exe)安装了 Java JDK 几次——但我显然遗漏了一些东西.
I'm having a problem getting my android dev environment setup in Windows 7. I follow the instructions here, as well as several environment sublinks. I am using Eclipse with the Android plugin. I have installed the Java JDK several times, in various locations (jdk-6u20-windows-i586.exe) - but I am obviously missing something.
每次我运行android create avd --target 2 --name my_avd"时都会出现错误:
Every time I run "android create avd --target 2 --name my_avd" I get an error:
C:Usersandrew>android create avd --target 2 --name my_avd
WARNING: Java not found in your path.
Checking it it's installed in C:Program FilesJava instead.
ERROR: No suitable Java found. In order to properly use the Android Developer
Tools, you need a suitable version of Java installed on your system. We
recommend that you install the JDK version of JavaSE, available here:
http://java.sun.com/javase/downloads/
You can find the complete Android SDK requirements here:
http://developer.android.com/sdk/requirements.html
此错误消息是我多次安装 JDK 的原因.首先,我尝试安装到我的 e: 驱动器上的某个位置.然后我将它移动到默认位置(程序文件(x86)javajdk.6.something.我还尝试强制它进入程序文件路径,但它仍然自动安装到(x86)路径中.我每次都将安装路径添加到我的路径环境变量中,但我仍然继续收到此错误.我怀疑Windows 7和android工具在查找JDK方面没有很好地配合,但谁知道呢,它可能完全不同.如果您以前见过此错误,我将不胜感激.
This error message is the reason for me installing the JDK several times over. First I tried installing to a location on my e: drive. I then moved it to the default loc (program files (x86)javajdk.6.something. I also tried forcing it to go into the program files path, but it still automatically installs into the (x86) path. I have added the install path to my path environment variable every single time, yet I still continue to get this error. My suspicion is that windows 7 and the android tools are not playing together well in terms of finding the JDK, but who knows, it may be something entirely different. If you have seen this error before, I would appreciate a hint.
推荐答案
android
命令只是一个 Windows 批处理文件,它反过来使用批处理文件 toolslibfind_java.bat
来查找 Java.
The android
command is just a Windows Batch file which in turn uses the batch file toolslibfind_java.bat
to find Java.
查看源代码,它执行以下操作:
Having a look at the source, it does the following:
- 查看
java.exe
是否在您的PATH
上. - 在
%ProgramFiles%
下的某处寻找
java.exe
出现问题是因为您使用的是 64 位版本的 Windows.这意味着 %ProgramFiles%
是 C:Program Files
但 Java 安装在 C:Program Files (x86)
中,因为它是 32-位应用程序,意思是 find_java.bat
没有找到它.
Your problem arises because you're using the a 64-bit version of Windows. This means %ProgramFiles%
is C:Program Files
but Java is installed in C:Program Files (x86)
as it's a 32-bit application, meaning find_java.bat
doesn't find it.
因此,要解决此问题,您需要将包含 java.exe
的目录添加到 PATH 环境变量中.
So to fix this you'll need to add the directory containing java.exe
to your PATH environment variable.
您需要将包含 java.exe
的目录(例如 C:Program Files (x86)Javajdk6in
)添加到PATH
的结尾,前面有一个分号,以将其与上一个条目分开.
You'll need to the add the directory containing java.exe
- something like C:Program Files (x86)Javajdk6in
- on to the end of PATH
with a semicolon in front of it to separate it from the previous entry.
superuser.com 上的这个问题 涉及维护环境Windows 7 中的变量.
This question on superuser.com covers maintaining Environment Variables in Windows 7.
相关文章