Java Android Studio 错误:“环境变量未指向有效的 JVM 安装”

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

Android Studio error: "Environment variable does not point to a valid JVM installation"

javaandroidjvmjava-home

提问by ifconfig

When trying to run Android Studio on my computer, I get the following error:

尝试在我的计算机上运行 Android Studio 时,出现以下错误:

The Environment variable JAVA_HOME (with a value of C:\Program?Files(x86)\Java\jdk1.7.0_51\bin) does not point to a valid JVM installation

环境变量 JAVA_HOME(值为 C:\Program?Files(x86)\Java\jdk1.7.0_51\bin)未指向有效的 JVM 安装

I tried to remove the \binextension on my JAVA_HOMEenvironment variable, but it gives me the following error:

我试图删除\bin我的JAVA_HOME环境变量上的扩展名,但它给了我以下错误:

No JVM Found. Please install a 64-bit JDK. If you already have a JDK installed, define a JAVA_HOME variable in Computer > System Properties > System Settings > Environment Variables

未找到 JVM。请安装 64 位 JDK。如果您已经安装了 JDK,请在计算机 > 系统属性 > 系统设置 > 环境变量中定义一个 JAVA_HOME 变量

  • My System:Windows 8.1 Update 1 x64 (64 bit)
  • Java Directory:C:\Program Files (x86)\Java\jdk1.7.0_51\bin
  • 我的系统:Windows 8.1 Update 1 x64(64 位)
  • Java 目录:C:\Program Files (x86)\Java\jdk1.7.0_51\bin

采纳答案by edthethird

Do step by step as shown in this YouTube Video

按照此YouTube 视频中所示的步骤进行操作

Go to: System -> Advanced system settings -> Environment Variables

去: System -> Advanced system settings -> Environment Variables

Add a new variable to you profile NAME=JAVA_HOMESTRING: Program Files/java/"your string"Save and Start Android Studio ;)

向您的配置文件添加一个新变量NAME=JAVA_HOMESTRING: Program Files/java/"your string"保存并启动 Android Studio ;)

enter image description here

在此处输入图片说明

回答by prakhar19

You have a problem with your Java JDK installation. So, try reinstalling it. You can download it from: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

您的 Java JDK 安装有问题。所以,尝试重新安装它。您可以从以下位置下载:http: //www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

It looks that you have a 64-bit system, so download the "Windows x64" version.

看起来你有一个 64 位系统,所以下载“Windows x64”版本。

回答by Muzaffer

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 AKY

All you need to do is, set the JAVA_HOMEand JDK_HOMEenvironment variables by following the steps:

您需要做的就是按照以下步骤设置JAVA_HOMEJDK_HOME环境变量:

1)Right click on

1)右键单击

My Computer.->>Properties->>Advanced System Settings.->>Environment Variables

我的电脑。->>属性->>高级系统设置。->>环境变量

.

.

2)In user variables for (Your PC name),click on new at botton of the tab.

2)在(您的PC名称)的用户变量中,单击选项卡底部的新建。

3)In variable name,type JAVA_HOME

3)在变量名中,输入JAVA_HOME

4)In variable value,type

4)在变量值中,输入

C:\Program Files\Java\jdk1.8.0_25

C:\Program Files\Java\jdk1.8.0_25

(path where your jdk folder is located on the system ).

(您的 jdk 文件夹在系统上的路径)。

5)Do it again with JDK_HOME

5)用 JDK_HOME再做一次

with same path.

用相同的路径。

回答by Giehl Man

Providing both JAVA_HOMEand JDK_HOMEwith identical Path without \binhelped for me! My settings:

在没有\bin 的情况下为JAVA_HOMEJDK_HOME提供相同的路径对我有帮助!我的设置:

  • JAVA_HOME
  • JAVA_HOME

\Program Files\Java\jdk1.8.0_05

\Program Files\Java\jdk1.8.0_05

  • JDK_HOME
  • JDK_HOME

%JAVA_HOME%

%JAVA_HOME%

  • PATH
  • 小路

...%JAVA_HOME%\bin

...%JAVA_HOME%\bin

回答by Manav Patadia

To solve this, add the JAVA_HOME variable in Users variables instead of System variables.

要解决此问题,请在用户变量而不是系统变量中添加 JAVA_HOME 变量。

Install 64 bit JDK and JRE if you have a 64-bit computer and set the JAVA_HOME variable like in the picture

如果您有 64 位计算机,请安装 64 位 JDK 和 JRE 并设置 JAVA_HOME 变量,如图所示

https://www.dropbox.com/sh/4ysuelcz00rphxk/AABwQPXql1b2ciWQDSJjkcT2a?dl=0

https://www.dropbox.com/sh/4ysuelcz00rphxk/AABwQPXql1b2ciWQDSJjkcT2a?dl=0

回答by Devan Appu

If you start 64bit Android Studio, you have to add in User Variable as

如果您启动 64 位 Android Studio,则必须将用户变量添加为

"JAVA_HOME"
"C:\Program Files\Java\jdk1.8.0_31"

If 32bit

如果是 32 位

"JAVA_HOME"
"C:\Program Files\Java\jdk1.8.0_31"

and don't put \binend

不要\bin结束

then comes to system variable

然后是系统变量

select and edit "path" as

选择并编辑“路径”为

"C:\Program Files\Java\jdk1.8.0_31\bin"

here u should must put " bin;" at end also put ; together.....Okey do it

在这里你必须把“ bin;”放在最后也放; 一起......好吧

回答by Karthick

Adding the following path without back slash '\' at the end worked for me. C:\Program Files\Java\jdk1.8.0_31

在最后添加不带反斜杠 '\' 的以下路径对我有用。C:\Program Files\Java\jdk1.8.0_31

回答by Abdulhaq Shah

Just set the Environment variable to JAVA_HOMEof

只需将环境变量设置为JAVA_HOME

C:\Program Files\Java\jdk1.7.0_51)

C:\Program Files\Java\jdk1.7.0_51)

with out bin for 64 bitversion and same for 32 bitversion with Program Files(x86).

对于64 位版本没有 bin,对于带有 Program Files(x86) 的32 位版本也是如此。

NO \BINafter the path it will work properly.

NO\BIN路径后它会正常工作。

回答by JFO

I solved this problem by making sure that the value of JAVA_HOMEwas the folder location in English

我通过确保JAVA_HOME的值 是英文文件夹位置来解决这个问题

C:\Program Files\Java\jdk1.8.0_31

C:\Program Files\Java\jdk1.8.0_31

rather than the folder location that one can see/explorer browse in my Windows7 - Portuguese installation

而不是在我的 Windows7 中可以看到/资源管理器浏览的文件夹位置 - 葡萄牙语安装

C:\Programas\Java\jdk1.8.0_31

C:\Programas\Java\jdk1.8.0_31