Java Android Studio - 未找到 JVM 安装

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

Android Studio - No JVM Installation found

javaandroidjvmandroid-studio

提问by Syed Qarib

I'm having issues trying to boot-up Android Studio

我在尝试启动时遇到问题 Android Studio

When I try to launch it after installation I'm getting this error:

当我在安装后尝试启动它时,出现此错误:

No JVM Installation found. Please install a 64 bit JDK.

No JVM Installation found. Please install a 64 bit JDK.



My current system specification:

我目前的系统规格:

Operating System: Windows 8.0 64 bit version
JDK installed: JDK 1.8.0

操作系统:Windows 8.0 64 bit version
JDK安装:JDK 1.8.0



What I have tried:

我尝试过的:

I have tried what was reported in the error, and also in most of the solutions to set the JDK_HOMEvariable in environment variables to my JDK path (64 bit version) i.e. C:\Program Files\Java\jdk1.8.0_05

我已经尝试过错误中报告的内容,以及在大多数解决方案JDK_HOME中将环境变量中的变量设置为我的 JDK 路径(64 位版本)即C:\Program Files\Java\jdk1.8.0_05

*I also have tried rebooting system, just in case to test if the environment variable is not working without a restart

*I also have tried rebooting system, just in case to test if the environment variable is not working without a restart



I have seen these solutions and tried but none of them works, so don't mark it as a duplicate of any of these:
Android Studio installation on Windows 7 fails, no JDK found
With android studio no jvm found, JAVA_HOME has been set
Android Studio start fails on Windows 8 64bit
Android Studio does not launch after installation

我已经看过这些解决方案并尝试过,但它们都不起作用,所以不要将其标记为以下任何一个的重复:
Windows 7 上的 Android Studio 安装失败,未找到 JDK
使用 android studio 未找到 jvm,JAVA_HOME 已设置为
Android Studio 在 Windows 8 上启动失败 64 位
Android Studio 安装后无法启动



Here is the cmd output for java version:

这是java版本的cmd输出:

enter image description here

在此处输入图片说明

采纳答案by bitkot

I had the same problem. I tried setting all kind of paths but nothing worked. So I had to do some dirty fix. The only problem with this is that it opens a blank command line window.

我有同样的问题。我尝试设置各种路径,但没有任何效果。所以我不得不做一些肮脏的修复。唯一的问题是它会打开一个空白的命令行窗口。

I did the following to make it work.

我做了以下工作以使其工作。

  • goto the AndroidStudio installation folder.
  • goto binfolder and open studio.batin text editor
  • add set JAVA_HOME=C:\Program Files\Java2\jdk1.8.0//your java path after the ECHO line.
  • goto Start-> All Programmes-> Android Studio->
  • right click on Android Studioand click on properties.
  • You will see the Targetsomething like <installation path>android-studio\bin\studio64.exe
  • change it to <installation path>android-studio\bin\studio.bat
  • 转到 AndroidStudio 安装文件夹。
  • 转到bin文件夹并studio.bat在文本编辑器中打开
  • set JAVA_HOME=C:\Program Files\Java2\jdk1.8.0在 ECHO 行之后添加//您的 java 路径。
  • 转到Start-> All Programmes-> Android Studio->
  • 右键单击Android Studio并单击properties
  • 你会看到Target类似的东西<installation path>android-studio\bin\studio64.exe
  • 将其更改为 <installation path>android-studio\bin\studio.bat

Now you can access it by clicking it from the menu.

现在您可以通过从菜单中单击它来访问它。

Note :I tried it with 8, It works.

注意:我用 8 试过,它有效。

回答by hd1

According to Oracle's installation notes, you should download/install JDK for the correct system. For your convenience, I have linked to it from the sentence above. If you still encounter problems, leave a comment. I have written some quick code that will tell you if your JVM is 64 or 32-bit, below. I'd suggest you run this class and leave a comment as to its output:

根据 Oracle 的安装说明,您应该为正确的系统下载/安装JDK。为了您的方便,我从上面的句子链接到它。如果您仍然遇到问题,请发表评论。我编写了一些快速代码,可以告诉您 JVM 是 64 位还是 32 位,如下所示。我建议你运行这个类并对其输出发表评论:

public class CheckMemoryMode {
    public static void main(String[] args) {
        System.err.println(System.getProperty("sun.arch.data.model"));
    }
}

回答by Martin Revert

Uninstall Java 8 and clean your JDK_HOME and your JAVA_HOME enviromental paths. Then install 64bit JAVA 6 or 7 JDK of your preference.

卸载 Java 8 并清理 JDK_HOME 和 JAVA_HOME 环境路径。然后安装您喜欢的 64 位 JAVA 6 或 7 JDK。

回答by Robert Dean

I reproduced your issue on my Windows 8.1system :

我在Windows 8.1系统上重现了您的问题:

  1. Installed 64-bit JDK 1.8.0_11.
  2. Installed latest Android Studio Bundle.
  3. Went to Control Panel -> System -> Advanced system settings -> Environment Variables...
  4. Added JDK_HOMEpointing to my 64-bit JDK.
  5. Launched studio64.exe
  1. 安装了64 位 JDK 1.8.0_11
  2. 安装了最新的 Android Studio Bundle。
  3. 进入控制面板 -> 系统 -> 高级系统设置 -> 环境变量...
  4. 添加指向我的 64 位 JDK 的JDK_HOME
  5. 推出studio64.exe

I got the same message you did. Thinking that it might be the environment variable, I did the following :

我收到了和你一样的消息。认为它可能是环境变量,我做了以下事情:

  1. Went to Control Panel -> System -> Advanced system settings -> Environment Variables...
  2. Changed the name of JDK_HOMEto JAVA_HOME.
  3. Launched studio64.exe
  1. 进入控制面板 -> 系统 -> 高级系统设置 -> 环境变量...
  2. JDK_HOME的名称更改为JAVA_HOME
  3. 推出studio64.exe

It came up successfully !

它成功地出现了!

回答by VVB

I think Android does not support Java 8. Officially android need java 6 as mentioned at the below:

我认为 Android 不支持 Java 8。正式 android 需要 Java 6,如下所述:

https://developer.android.com/sdk/installing/installing-adt.html

https://developer.android.com/sdk/installing/installing-adt.html

Here I'm providing you a good link, hope those will clear this question :

在这里,我为您提供了一个很好的链接,希望那些人能解决这个问题:

Is it possible to use Java 8 for Android development?

是否可以将 Java 8 用于 Android 开发?

回答by fatah amine

1-Right click on Android Studio and click on properties.

1-右键单击Android Studio,然后单击属性。

2-Replace studio64.exe in link by studio.exe.

2-用studio.exe替换链接中的studio64.exe。

回答by Alberto Saint Martin

In my case

就我而言

In Control Panel -> System -> Advanced system settings -> Environment Variablesthere is no JDK_HOMEOR JAVA_HOME

Control Panel -> System -> Advanced system settings -> Environment Variables没有JDK_HOMEORJAVA_HOME

SO

所以

I addedan entry named: JDK_HOMEpointing to: C:\Program Files\Java\jdk1.8.0_25\(you have to point this to your JDK instalation path)

我添加了一个名为:JDK_HOME的条目, 指向:C:\Program Files\Java\jdk1.8.0_25\(您必须将其指向您的 JDK 安装路径)

And all seems to work fine now

现在似乎一切正常

回答by Nigel Crasto

Android Studio Works Perfectly fine with Java 1.8or Java 8. I was also having invalid JVM error. The reason was including ";" (semicolon) at the end of JAVA_HOMEpath value. The correct format for path value is:

Android Studio 与Java 1.8或完美配合Java 8。我也遇到了无效的 JVM 错误。原因是包括“;” (分号)在JAVA_HOME路径值的末尾。路径值的正确格式是:

C:\Program Files\Java\jdk1.8.0_xx (Replace xx with your current version)

C:\Program Files\Java\jdk1.8.0_xx(用你当前的版本替换xx)

Do not include ;(semicolon) at the end of JAVA_HOMEvalue

不要;JAVA_HOME值的末尾包含(分号)

回答by Nico

Here comes the solution.

解决方案来了。

Just start ANDROID STUDIO as administratorif you are using a non administrator windows profile!

如果您使用的是非管理员 Windows 配置文件,只需以管理员身份启动 ANDROID STUDIO !

If your environment variables are correct that will do the trick. Enjoy!

如果你的环境变量是正确的,那就可以了。享受!

回答by Paul

  • For me this turns out to be Environment Variables not being inherited.
  • Quick answer: reboot, than click on studio.bat, not studio.exe or studio64.exe
  • 对我来说,这证明是环境变量没有被继承。
  • 快速回答:重启,而不是点击 studio.bat,而不是 studio.exe 或 studio64.exe

================ Details =================

================ 详情================

  • "Right Click"-"Run as Administrator" works for me if: ** JDK_HOME or JAVA_HOME was set. (PATH didn't need to be changed for me) ** I run studio.bat, not studio.exe ** Note: By Default I am an administrator on a Microsoft Account (That Microsoft part may be affecting things), and I seldom reboot. I'm running Win8.1 64bit. I installed both JDKv1.8.0.0_25 32bit and 64 bit, and had JRE 32bit and 64 bit already installed (used by other software).

  • I found there was a difference in clicking on studio.bat, studio.exe, and running studio.bat from a command prompt. There is also a difference if I rebooted or not.

  • The difference: The System Environment Variables aren't all there depending on how I start the program.

  • To test:

  • In start menu drag a copy of "command prompt" to your desktop, then change properties so "Start In" is location of studio.bat

  • copy studio.bat to studio_debug.bat (one we can mess with)
  • drag a shortcut of studio_debug.bat to desktop for convenience.
  • edit studio_debug.bat (right click --> edit)
  • - “右键”“以管理员身份运行”工作对我来说,如果** JDK_HOME或JAVA_HOME设置。(我不需要更改 PATH)** 我运行的是 studio.bat,而不是 studio.exe ** 注意:默认情况下,我是 Microsoft 帐户的管理员(Microsoft 部分可能会影响某些事情),并且我很少重启。我正在运行 Win8.1 64 位。我安装了 JDKv1.8.0.0_25 32 位和 64 位,并且已经安装了 JRE 32 位和 64 位(被其他软件使用)。

  • 我发现在命令提示符下单击 studio.bat、studio.exe 和运行 studio.bat 有所不同。我是否重新启动也有区别。

  • 区别在于:系统环境变量并非全部存在,这取决于我如何启动程序。

  • 去测试:

  • 在开始菜单中,将“命令提示符”的副本拖到桌面,然后更改属性,使“开始于”是 studio.bat 的位置

  • 将 studio.bat 复制到 studio_debug.bat(我们可以搞砸的)
  • 为方便起见,将 studio_debug.bat 的快捷方式拖到桌面。
  • 编辑 studio_debug.bat(右键单击 --> 编辑)

== Change:

==变化:

@echo off

== to

== 到

@echo on         
echo Set===================
set
echo ======================
pause
  • This may also help in debugging studio.bat:
  • 这也可能有助于调试 studio.bat:

== change:

==变化:

"%JAVA_EXE%" %ALL_JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*

== to

== 到

echo =================
echo Starting: "%JAVA_EXE%" %ALL_JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
pause
"%JAVA_EXE%" %ALL_JVM_ARGS% -cp "%CLASS_PATH%" %MAIN_CLASS_NAME% %*
echo =================
  • Now when you run studio.bat from command prompt versus double clicking you may see difference in environment variables including JAVA_HOME and PATH. If you do you have same problem as me.

  • The problem seems to depend on:

    1. did you reboot since changing environment variables?
    2. didn't seem to matter if I was local or microsoft account
    3. may depend whether you are an administrator or other account type
    4. whether you start using studio.bat, studio.exe, or studio64.exe
  • .

  • FYI: The actual successful startup command executed by studio.bat on my system was as follows (includes studio64.exe):

    "C:\Program Files\Java\jdk1.8.0_25\bin\java.exe" "-Xms128m" "-Xmx750m" "-XX:MaxPermSize=350m" "-XX:ReservedCodeCacheSize=96m" "-ea" "-Dsun.io.useCanonCaches=false" "-Djava.net.preferIPv4Stack=true" "-Djsse.enableSNIExtension=false" "-XX:+UseCodeCacheFlushing" "-XX:+UseConcMarkSweepGC" "-XX:SoftRefLRUPolicyMSPerMB=50" "-XX:+HeapDumpOnOutOfMemoryError" "-Didea.platform.prefix=AndroidStudio" "-Didea.paths.selector=AndroidStudioBeta" -Djb.vmOptionsFile="C:\android-studio\bin\studio64.exe.vmoptions" "-Xbootclasspath/a:C:\android-studio\bin\../lib/boot.jar" -Didea.paths.selector=AndroidStudioBeta -Didea.platform.prefix=AndroidStudio -cp "C:\android-studio\bin\..\lib\bootstrap.jar;C:\android-studio\bin\..\lib\extensions.jar;C:\android-studio\bin\..\lib\util.jar;C:\android-studio\bin\..\lib\jdom.jar;C:\android-studio\bin\..\lib\log4j.jar;C:\android-studio\bin\..\lib\trove4j.jar;C:\android-studio\bin\..\lib\jna.jar;C:\Program Files\Java\jdk1.8.0_25\lib\tools.jar" com.intellij.idea.Main

  • Hope that helps someone else.

  • 现在,当您从命令提示符与双击运行 studio.bat 时,您可能会看到环境变量(包括 JAVA_HOME 和 PATH)的差异。如果你有和我一样的问题。

  • 问题似乎取决于:

    1. 更改环境变量后是否重新启动?
    2. 如果我是本地帐户或微软帐户似乎并不重要
    3. 可能取决于您是管理员还是其他帐户类型
    4. 无论您是开始使用 studio.bat、studio.exe 还是 studio64.exe
  • .

  • 仅供参考:studio.bat 在我的系统上执行的实际成功启动命令如下(包括 studio64.exe):

    "C:\Program Files\Java\jdk1.8.0_25\bin\java.exe" "-Xms128m" "-Xmx750m" "-XX:MaxPermSize=350m" "-XX:ReservedCodeCacheSize=96m" "-ea" "- Dsun.io.useCanonCaches=false" "-Djava.net.preferIPv4Stack=true" "-Djsse.enableSNIExtension=false" "-XX:+UseCodeCacheFlushing" "-XX:+UseConcMarkSweepGC" "-XX:SoftRefLRUPolicyMSPerMB=50" "- XX:+HeapDumpOnOutOfMemoryError" "-Didea.platform.prefix=AndroidStudio" "-Didea.paths.selector=AndroidStudioBeta" -Djb.vmOptionsFile="C:\android-studio\bin\studio64.exe.vmoptions" "-Xbootclasspath/ a:C:\android-studio\bin\../lib/boot.jar" -Didea.paths.selector=AndroidStudioBeta -Didea.platform.prefix=AndroidStudio -cp "C:\android-studio\bin\.. \lib\bootstrap.jar;C:\android-studio\bin\..\lib\extensions.jar;C:\android-studio\bin\..\lib\util.jar;C:\android-studio\bin\..\lib\ jdom.jar;C:\android-studio\bin\..\lib\log4j.jar;C:\android-studio\bin\..\lib\trove4j.jar;C:\android-studio\bin\. .\lib\jna.jar;C:\Program Files\Java\jdk1.8.0_25\lib\tools.jar" com.intellij.idea.Main

  • 希望能帮助别人。