简体   繁体   English

Android SDK中的Find_java.exe找不到Java

[英]Find_java.exe in Android SDK doesn't find Java

I've definitely got JDK 1.6.0 installed in C:\\Program Files\\Java\\jdk1.6.0_35 , but it never seems to be able to find it when I try to open the SDK Manager. 我肯定在C:\\Program Files\\Java\\jdk1.6.0_35安装了JDK 1.6.0,但是当我尝试打开SDK Manager时它似乎永远无法找到它。 In task manager, find_java.exe shows up until I stop it (will run for hours). 在任务管理器中,find_java.exe会一直显示,直到我停止它(将运行几个小时)。

Are there some environment variables I have to set for this to work? 我必须为此设置一些环境变量吗?

May be you are forgetting the PATH environmental variable. 可能是你忘记了PATH环境变量。 To check this use, 要检查这个用途,

In Unix/Linux systems, 在Unix / Linux系统中,

echo $PATH
echo $JAVA_HOME

In Windows systems, 在Windows系统中,

echo %PATH%
echo %JAVA_HOME%

If both the tests showed you empty lines, then you may need to set them again. 如果两个测试都显示空行,那么您可能需要再次设置它们。

To set them do this. 设置它们就可以了。 First try reinstalling java with UAC turned off. 首先尝试在关闭UAC重新安装java。 If it failed, do this at the cmd 如果失败,请在cmd处执行此操作

SetX PATH %PATH%;<path_to_jdk/jre>\bin\
SetX JAVA_HOME <path_to_jdk/jre>

Hope it helps and thinking you are using windows. 希望它有所帮助,并认为你正在使用Windows。

As you are using Windows system, use following way to set your JAVA_HOME and CLASSPATH Environment variables. 在使用Windows系统时,请使用以下方法设置JAVA_HOMECLASSPATH环境变量。

Windows XP Windows XP

  • Select Start, select Control Panel. 选择开始,选择控制面板。 double click System, and select the Advanced tab. 双击“系统”,然后选择“高级”选项卡。
  • Click Environment Variables. 单击“环境变量”。 In the section System Variables, find the PATH environment variable and select it. 在System Variables部分中,找到PATH环境变量并选择它。 Click Edit. 单击编辑。 If the PATH environment variable does not exist, click New. 如果PATH环境变量不存在,请单击“新建”。
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. 在“编辑系统变量”(或“新建系统变量”)窗口中,指定PATH环境变量的值。 Click OK. 单击确定。 Close all remaining windows by clicking OK. 单击“确定”关闭所有剩余窗口。

Windows Vista: Windows Vista:

  • From the desktop, right click the My Computer icon. 在桌面上,右键单击“我的电脑”图标。
  • Choose Properties from the context menu. 从上下文菜单中选择“属性”。
  • Click the Advanced tab (Advanced system settings link in Vista). 单击“高级”选项卡(Vista中的“高级系统设置”链接)。
  • Click Environment Variables. 单击“环境变量”。 In the section System Variables, find the PATH environment variable and select it. 在System Variables部分中,找到PATH环境变量并选择它。 Click Edit. 单击编辑。 If the PATH environment variable does not exist, click New. 如果PATH环境变量不存在,请单击“新建”。
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. 在“编辑系统变量”(或“新建系统变量”)窗口中,指定PATH环境变量的值。 Click OK. 单击确定。 Close all remaining windows by clicking OK. 单击“确定”关闭所有剩余窗口。

Windows 7: Windows 7的:

  • From the desktop, right click the Computer icon. 在桌面上,右键单击“计算机”图标。
  • Choose Properties from the context menu. 从上下文菜单中选择“属性”。
  • Click the Advanced system settings link. 单击“高级系统设置”链接。
  • Click Environment Variables. 单击“环境变量”。 In the section System Variables, find the PATH environment variable and select it. 在System Variables部分中,找到PATH环境变量并选择它。 Click Edit. 单击编辑。 If the PATH environment variable does not exist, click New. 如果PATH环境变量不存在,请单击“新建”。
  • In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. 在“编辑系统变量”(或“新建系统变量”)窗口中,指定PATH环境变量的值。 Click OK. 单击确定。 Close all remaining windows by clicking OK. 单击“确定”关闭所有剩余窗口。

Now in Addition for the Linux Based System following steps used to set JAVA_HOME and CLASSPATH variables, 现在,除了用于设置JAVA_HOMECLASSPATH变量的步骤之外,还有基于Linux的系统,

  • Open root folder 打开根文件夹
  • From the View Menu , ticK "Show Hidden Files" , or press Ctrl + H. 从“视图”菜单中,选择“显示隐藏文件”,或按Ctrl + H.
  • Now you can see a system hidden file called .bashrc 现在您可以看到一个名为.bashrc的系统隐藏文件
  • Right click and open it editor, and write following command at the end. 右键单击并打开它编辑器,最后编写以下命令。

     PATH=$PATH:/opt/jdk1.6.0_21/bin export PATH JAVA_HOME=/opt/jdk1.6.0_21 export JAVA_HOME NDK_HOME=/opt/android-ndk-r8 export NDK_HOME 
  • Save and Exit. 保存并退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM