Android Studio - JAVA_HOME 未指向有效的 JVM 安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28345340/
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-11 06:03:48  来源:igfitidea点击:

Android Studio - JAVA_HOME doesn't point to a valid JVM installation

javaandroidjvm

提问by oneshotfinch

Having trouble firing up android studio. Get the following message: The environment variable JAVA_HOME (with the value of ?C:\Program Files\Java\jdk1.8.0_31) does not point to a valid JVM installation. The problem is that as far as I can tell, the environment variable I set up IS pointing to a valid install.

无法启动 android studio。获取以下消息:环境变量 JAVA_HOME(值为 ?C:\Program Files\Java\jdk1.8.0_31)未指向有效的 JVM 安装。问题是,据我所知,我设置的环境变量指向有效安装。

I've tried everything from renaming it to JDK_HOME, to pointing it to all the sub directories in the jdk folder, to uninstalling and reinstalling java and android studio about 3 time. I have triple checked that I have 64 bit JAVA installed (and that my computer is 64 bit). Pretty much at the end of my rope here. Help would be appreciated big time.

我已经尝试了一切,从将它重命名为 JDK_HOME,到将它指向 jdk 文件夹中的所有子目录,再到卸载和重新安装 java 和 android studio 大约 3 次。我已经三重检查我是否安装了 64 位 JAVA(并且我的计算机是 64 位)。几乎在我绳子的尽头。帮助将不胜感激。

Here's a screen cap of my windows, you might spot something obvious I haven't:

这是我的窗户的屏幕截图,您可能会发现一些我没有发现的明显内容:

a screen cap of my windows

我的窗户的屏幕截图

回答by Anfaje

Remember that you have to set the JAVA_HOME variable to C:\Program Files\Java\jdk1.8.0_31, just like you set the variable JDK_HOME. :)

请记住,您必须将 JAVA_HOME 变量设置为 C:\Program Files\Java\jdk1.8.0_31,就像设置变量 JDK_HOME 一样。:)

See this post for reference: Android Studio installation on Windows 7 fails, no JDK found

请参阅此帖子以供参考: Windows 7 上的 Android Studio 安装失败,未找到 JDK

Also, you could try installing an older version of java, as the newest ones might not be compatible with your IDE. Reference: Android Studio error: "Environment variable does not point to a valid JVM installation"

此外,您可以尝试安装旧版本的 java,因为最新版本可能与您的 IDE 不兼容。参考:Android Studio 错误:“环境变量未指向有效的 JVM 安装”

回答by ashishgoel

in your system Variable ( path ) append this wilset the C:\Program Files\Java\jdk1.8.0_31

在您的系统变量 ( path ) 中附加此 wilset C:\Program Files\Java\jdk1.8.0_31

回答by Abhale Amol

Delete your all user variable paths from Environments Variable, and keep only two (TEMP & TMP) variables, it will work.

从环境变量中删除所有用户变量路径,只保留两个(TEMP 和 TMP)变量,它会起作用。

回答by Hemant Ramphul

To fix it, just remove "\bin" from my JAVA_HOME variable.

要修复它,只需从我的 JAVA_HOME 变量中删除“\bin”。

NOTE:be sure to put the JAVA_HOMEpath variable in the System variablesrather than the user variables. If the path variable is in User the Android Studio will not find the path.

注意:确保将JAVA_HOME路径变量放在.System variables而不是user variables. 如果路径变量在 User 中,Android Studio 将找不到路径。

回答by Guiovanni Jules

I use Windows 8.

我使用 Windows 8。

2 steps:

2个步骤:

  1. Download jdk-7u80-windows-x64.exe

    1.1 It's a requirement @ https://developer.android.com/sdk/index.html#Requirements

  2. Set JAVA_HOMEto C:\Program Files\Java\jdk1.7.0_80

  1. 下载 jdk-7u80-windows-x64.exe

    1.1 这是一个要求@ https://developer.android.com/sdk/index.html#Requirements

  2. 设置JAVA_HOMEC:\Program Files\Java\jdk1.7.0_80

NOTE: not in Program Files (x86)

注意:不在Program Files (x86)

回答by chaitanya

You can try this Android Studio error: "Environment variable does not point to a valid JVM instalation"

你可以试试这个 Android Studio 错误:“环境变量没有指向有效的 JVM 安装”

this works for me. If you start 64bit Android Studio, you have to add JAVA_HOME as

这对我有用。如果您启动 64 位 Android Studio,则必须将 JAVA_HOME 添加为

"C:\Program Files\Java\jdk..."

If 32bit

如果是 32 位

"C:\Program Files(x86)\Java\jdk..."

and dont put "\bin" end of the path.

并且不要将 "\bin" 放在路径的末尾。

回答by Fergus

Ensure JAVA_HOMEis in the "System Variables" and points to the JDK short path. For example if the JDK is C:\Program Files\Java\jdk1.7.0_79set JAVA_HOMEto C:\PROGRA~1\Java\JDK17~1.0_7. I was getting the above error message initially upon install but it started working when I made this change, and it was not necessary to reboot.

确保JAVA_HOME在“系统变量”中并指向 JDK 短路径。例如,如果 JDKC:\Program Files\Java\jdk1.7.0_79设置JAVA_HOMEC:\PROGRA~1\Java\JDK17~1.0_7. 我最初在安装时收到上述错误消息,但是当我进行此更改时它开始工作,并且没有必要重新启动。

回答by MRAgrawal

Faced same problem for many weeks. What worked for me: uninstalled all java from laptop then installed jdk 7 64 bit, deleted JAVA_HOME and added JDK_HOME.

好几个星期都面临同样的问题。对我有用的是:从笔记本电脑上卸载所有 java,然后安装 jdk 7 64 位,删除 JAVA_HOME 并添加 JDK_HOME。

回答by Arpit Patel

As you told you have 64 bit system then copy this path C:\Program Files\Java\jdk1.8.0_31

正如你告诉你有 64 位系统然后复制这个路径C:\Program Files\Java\jdk1.8.0_31

Step 1 :-Create JAVA_HOMEvariable by clicking new and past ( C:\Program Files\Java\jdk1.8.0_31) this path.

第 1 步:-通过单击新建和过去(C:\Program Files\Java\jdk1.8.0_31)此路径来 创建 JAVA_HOME变量。

Step 2Then click path variable and edit then past it your path after add semicolon (;)C:\Program Files\Java\jdk1.8.0_31

步骤 2然后单击路径变量并在添加分号 (;)C:\Program Files\Java\jdk1.8.0_31后编辑然后将其粘贴到您的路径

enter image description here

在此处输入图片说明

I am using windows 10so this windows look like this

我正在使用Windows 10所以这个窗口看起来像这样

enter image description here

在此处输入图片说明

Note :-If above dialog not open then , select path variable and click on Edit…. Locate the end of the current variable value append the path of jdk, using a semicolonAnd click ok

注意:-如果上面的对话框未打开,则选择路径变量并单击编辑...。找到当前变量值的 末尾追加jdk的路径,用分号然后点击ok

回答by Jayaprakash Nevara

make JAVA_HOMEa system variable under environment variables and set it to C:\Program Files\Java\jdk1.8.0_31.

JAVA_HOME在环境变量下创建一个系统变量并将其设置为C:\Program Files\Java\jdk1.8.0_31.

After that logout and login back. This should eliminate the error message that you are getting. Then launch the Android Studio.

之后注销并重新登录。这应该消除您收到的错误消息。然后启动 Android Studio。