android studio java 以非零退出值 2 结束

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

android studio java finished with non-zero exit value 2

javaandroidubuntu

提问by Lukas Kock

I installed the java jdk1.8.0_111 and installed android studio in ubuntu 16.04 (32 bits), but when I run android studio I get the message:

我安装了 java jdk1.8.0_111 并在 ubuntu 16.04(32 位)中安装了 android studio,但是当我运行 android studio 时,我收到消息:

Error:Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2

Error:Process 'command '/usr/local/android-studio/jre/bin/java'' finished with non-zero exit value 2

print screen

打印屏幕

What should I do?

我该怎么办?

采纳答案by Lukas Kock

I found the solution. I think Android Studio was using 2 java compilers, one built-in from android studio, and the other the one that I had installed in order to install Android Studio.

我找到了解决方案。我认为 Android Studio 使用了 2 个 java 编译器,一个是从 android studio 内置的,另一个是我为了安装 Android Studio 而安装的。

In Android Studio, On the menu File -> Project Structure: change the default JDK location directoryto your own, in my case it was:

Android Studio 中,在菜单File -> Project Structure 上将默认的 JDK 位置目录更改为您自己的目录,在我的情况下是:

/usr/local/android-studio/jre

/usr/local/android-studio/jre

and I changedto

/usr/local/java/jdk1.8.0_111 #path_to_your_jdk

/usr/local/java/jdk1.8.0_111 #path_to_your_jdk

which is the version that I installed.

这是我安装的版本。

Picture of the window

窗户的图片