我有 64 位 Java,但我的 Program Files\Java 文件夹中没有 jdk 文件夹?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22188096/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 14:11:59  来源:igfitidea点击:

I have 64 bit Java, but no jdk folder in my Program Files\Java folder?

javapath-variables

提问by u3l

I'm trying to set the JAVA_HOMEenvironment variable - I need to set it to the 64 bit version.

我正在尝试设置JAVA_HOME环境变量 - 我需要将其设置为 64 位版本。

To make sure I have the 64 bit version, I checked java -versionby the cmd prompt, and got the output:

为了确保我有 64 位版本,我java -version通过 cmd 提示符进行了检查,并得到了输出:

Java version "1.7.0_25" 
Java<TM> SE Runtime Environment <build 1.7.0_25-b17>
Java Hotspot<TM> 64-bit Server VM <build 23.25-b01, mixed mode>

I'm assuming the last line verifies I have 64-bit... so I went to check the exact path to type into the environment variable, and found that Program Files\Java\does not contain a jdkfolder. However, Program Files (x86)\Java\does. Instead, the former only has a jre7folder.

我假设最后一行验证我有 64 位...所以我去检查输入环境变量的确切路径,发现它Program Files\Java\不包含jdk文件夹。然而,Program Files (x86)\Java\确实如此。相反,前者只有一个jre7文件夹。

I can't direct my environment variable to the 32-bit folder because Android Studiokeeps telling me that I need 64-bit java. What am I missing?

我无法将我的环境变量定向到 32 位文件夹,因为Android Studio一直告诉我我需要 64 位 java。我错过了什么?

(If this belongs on SuperUser and not here, just comment below and i'll delete the question here)

(如果这属于超级用户而不是这里,请在下面发表评论,我会在这里删除问题)

回答by user3381763

I think you are looking at JRE

我想你在看 JRE

type

类型

javac -version

in your command line

在你的命令行

回答by Fred Grott

your JDK will have a jre folder...set your JAVA_HOME pointing to that as that is what android studio will expect as the JAVA_HOME env

您的 JDK 将有一个 jre 文件夹...将您的 JAVA_HOME 设置为指向该文件夹,因为这就是 android studio 期望的 JAVA_HOME 环境

回答by Paul Becotte

You can have multiple Javas installed. Sounds like you have a 32 bit JDK and a 64 bit JRE. 64 bit software is installed in the "program files" folder, and 32 bit software is installed in the "program files (x86)" folder.

您可以安装多个 Java。听起来你有一个 32 位的 JDK 和一个 64 位的 JRE。64位软件安装在“程序文件”文件夹中,32位软件安装在“程序文件(x86)”文件夹中。

a 64 bit JDK will live in /program files/java/jdkxxx

64 位 JDK 将位于 /program files/java/jdkxxx

Download the 64 bit JDK installer and install it, and then point your JAVA_HOME to it.

下载 64 位 JDK 安装程序并安装它,然后将您的 JAVA_HOME 指向它。

The installer takes care of this so far as I remember, but you will want to modify your PATH variable as well to point to %JAVA_HOME%/bin; ... add that to the front of the path so that typing Java will find your JDK first.

据我所知,安装程序会处理这个问题,但是您还需要修改 PATH 变量以指向 %JAVA_HOME%/bin; ...将其添加到路径的前面,以便键入 Java 将首先找到您的 JDK。