Java 安装 Android Studio,未指向有效的 JVM 安装错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/21119021/
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
Installing Android Studio, does not point to a valid JVM installation error
提问by LegionDev
I just downloaded the Android Studio. While trying to run it, I had to modify the environment variable and add
我刚刚下载了 Android Studio。在尝试运行它时,我不得不修改环境变量并添加
JAVA_HOME
JAVA_HOME
and
和
C:\Progra~2\Java\jdk1.6.0_22
C:\Progra~2\Java\jdk1.6.0_22
Once I finished that hurdle, now I am receiving another error:
一旦我完成了那个障碍,现在我收到另一个错误:
The environment variable JAVA_HOME (with the value of *C:\Progra~2\Java\jdk1.6.0_22*) does not point to a valid JVM installation.
I looked through other similar questions and I was asked to check the version, so I did the following in CMD:
我查看了其他类似的问题,并被要求检查版本,因此我在 CMD 中执行了以下操作:
C:\Users\Andre>java -version
java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) Client VM (build 17.1-b03, mixed mode, sharing)
C:\Users\Andre>javac -version
javac 1.6.0_22
From the results it seems like I have JVM.
从结果看来,我有 JVM。
I also tried these paths for JAVA_HOME, I closed and reopened a new CMD window each time
我也为 JAVA_HOME 尝试了这些路径,我每次都关闭并重新打开一个新的 CMD 窗口
C:\Program Files (x86)\Java\jre7
C:\Program Files (x86)\Java\jre6
C:\Program Files (x86)\Java\jdk1.6.0_22
C:\Program Files (x86)\Java\jre7\bin
C:\Program Files (x86)\Java\jre6\bin
C:\Program Files (x86)\Java\jdk1.6.0_22\bin
采纳答案by Edwin Mokami
Point your JAVA_HOME
variable to C:\Program Files\Java\jdk1.8.0_xx\
where "xx" is the update number (make sure this matches your actual directory name). Do not include bin\javaw.exe
in the pathname.
将JAVA_HOME
变量指向C:\Program Files\Java\jdk1.8.0_xx\
“xx”是更新编号的位置(确保它与您的实际目录名称匹配)。不要包含bin\javaw.exe
在路径名中。
NOTE: You can access the Environment Variables GUI from the CLI by entering rundll32 sysdm.cpl,EditEnvironmentVariables
. Be sure to put the 'JAVA_HOME' path variable in the System variables
rather than the user variables. If the path variable is in User
the Android Studio will notfind the path.
注意:您可以通过在 CLI 中输入rundll32 sysdm.cpl,EditEnvironmentVariables
. 确保将“JAVA_HOME”路径变量放在System variables
而不是用户变量中。如果路径变量是User
在Android Studio将无法找到路径。
回答by Abs
2 suggested solutions
2 建议的解决方案
Upgrade JDK to 1.7
Make sure the 32-bit or 64 bit versions match on both sides
将 JDK 升级到 1.7
确保 32 位或 64 位版本在两侧匹配
回答by Sagar Devanga
Follow @abs solution
遵循@abs 解决方案
If you still continue to get the error even after setting the JAVA_HOME variable Copy the studio folder to your C drive and then run the studio.exe or studio64.exe depending upon your java versio
如果即使在设置 JAVA_HOME 变量后仍然继续出现错误将 studio 文件夹复制到 C 驱动器,然后根据您的 java 版本运行 studio.exe 或 studio64.exe
回答by Master
It is absolutely possible that all other answers work for people but for me this path worked:
绝对有可能所有其他答案都适用于人们,但对我而言,这条道路有效:
Leave your JDK path under JAVA_HOME
System Variable as it is given here. Do not append bin or another path. It worked for me.
将您的 JDK 路径保留在JAVA_HOME
系统变量下,因为它是在此处给出的。不要附加 bin 或其他路径。它对我有用。
C:\Program Files\Java\jdk1.8.0_11\
Otherwise I am getting this error:
否则我会收到此错误:
Installing Android Studio, does not point to a valid JVM installation error
回答by alexventuraio
Recently I am working with the 1.8.0_25 JDK version on Windows 8.1 and I had the same problem with this. But as PankaJ Jakhar said
最近我在 Windows 8.1 上使用 1.8.0_25 JDK 版本,我遇到了同样的问题。但正如 PankaJ Jakhar 所说
The real solution for me was pretty simple:
对我来说真正的解决方案非常简单:
- Add the JAVA_HOME variable to the system ones, not on the user ones.
The path I introduced for this variable was:
C:\Program Files\Java\jdk1.8.0_25\
- 将 JAVA_HOME 变量添加到系统变量,而不是用户变量。
我为这个变量引入的路径是:
C:\Program Files\Java\jdk1.8.0_25\
And it works for me!
它对我有用!
回答by AnR
I am using 64-bit Windows. After battling with various settings I followed these steps:
我正在使用 64 位 Windows。在与各种设置作斗争之后,我遵循了以下步骤:
- Thru Add/Remove Programs I uninstalled all Java(s)
- Removed JAVA_HOME variable from environment
- Removed Java folder reference from PATH environment variable
- Downloaded and installed 64-bit Java SDK
- Added JAVA_HOME variable in system variables and assigned it the value C:\Program Files\Java\jdk1.8.0_31
- 通过添加/删除程序我卸载了所有 Java(s)
- 从环境中删除了 JAVA_HOME 变量
- 从 PATH 环境变量中删除了 Java 文件夹引用
- 下载并安装 64 位 Java SDK
- 在系统变量中添加 JAVA_HOME 变量并为其赋值 C:\Program Files\Java\jdk1.8.0_31
In the last step please note that its the parent Folder and not the \bin sub-folder. It started working.
在最后一步中,请注意它的父文件夹而不是 \bin 子文件夹。它开始工作了。
回答by Rahul Sonone
Don't include bin folder while coping the path for Java_home.
在处理 Java_home 的路径时不要包含 bin 文件夹。
回答by Jared Sanchez
I had this problem as well, and I must have tried 20 different path adding solutions before I worked it out. Someone mentioned it above almost as a side note, but this was exactly my issue:
我也遇到了这个问题,在我解决之前,我必须尝试过 20 种不同的路径添加解决方案。上面有人提到它几乎是作为旁注,但这正是我的问题:
make sure you are running a 64-bit version of java.
确保您运行的是 64 位版本的 java。
回答by Rodrigo Venancio
In my case, it started hapenning after I updated to Android Studio 1.2. To fix it I just had to remove "\bin" from my JAVA_HOME variable.
就我而言,它在我更新到 Android Studio 1.2 后开始发生。要修复它,我只需要从我的 JAVA_HOME 变量中删除 "\bin"。
回答by Kevan
My problem was different to any of the above as far as I can tell. I had a working version 1.1 of Android Studio and upgraded to 1.2 Then I got the JAVA_HOME error when starting 1.2
据我所知,我的问题与上述任何问题都不同。我有一个 Android Studio 1.1 的工作版本并升级到 1.2 然后我在启动 1.2 时遇到了 JAVA_HOME 错误
The problem was that my JAVA_HOME was set to "C:\Program Files\Java\jdk1.8.0_20" with quotation marks included. I haven't put them there to quote the string, the quotation marks were in the Variable Value field. It appears that 1.1 is happy with the quotes being there but 1.2 is not.
问题是我的 JAVA_HOME 设置为 "C:\Program Files\Java\jdk1.8.0_20" 并包含引号。我没有把它们放在那里来引用字符串,引号在变量值字段中。似乎 1.1 对存在的引号感到满意,但 1.2 则不然。
Removing quotes removed the error and 1.2 now opens fine
删除引号删除了错误,现在 1.2 可以正常打开