13

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:

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

print screen

What should I do?

Nicolas Filotto
  • 43,537
  • 11
  • 94
  • 122
Lukas Kock
  • 439
  • 1
  • 3
  • 9
  • Have you tried this ? http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle – George_v Nov 18 '16 at 17:45
  • did you create a path variable to your jdk/jre ? – Merve Sahin Nov 18 '16 at 18:32
  • I added the java variable path in the etc/profile file @MerveSahin and, torpillo, my build.gradle file doesn't java 2 java dependencies (I don't know how to show you the file here) and I think the problem is that Android Studio is executing two java's, my own, inside /usr/local/java/ and one from Android Studio, in /usr/local/android-studio/jre/bin/java, I went to Settings but couldn't find anywhere how to change that. If you find out how, please help me – Lukas Kock Dec 05 '16 at 16:57

1 Answers1

20

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.

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

/usr/local/android-studio/jre

and I changed to

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

which is the version that I installed.

Picture of the window

Luciano van der Veekens
  • 6,307
  • 4
  • 26
  • 30
Lukas Kock
  • 439
  • 1
  • 3
  • 9
  • @AbdellahRamadan you're welcome. I haven't test it on other Linux plataforms. Good that it worked on that too. Thanks for the reply. – Lukas Kock Feb 06 '18 at 10:00
  • 4
    Works for me. A useful command to find out where the path of your jdk is on Linux is readlink -f $(which java). Then you can copy that path end at the jdk or java-x-oracle as the path to your jdk. – Akah Mar 08 '18 at 14:12