android studio does not launch in ubuntu 14.04

i am trying to install android studio in ubuntu, but when i execute the studio.sh, i get the following error:

Unrecognized VM option 'MaxPermSize=350m'
Error: Could not create the Java Virtual Machine.

i have java and jdk installed, my JAVA_HOME: /usr/lib/jvm/jdk1.8.0_60/bin/

java -version output:

java version "1.9.0-ea" Java(TM) SE Runtime Environment (build 1.9.0-ea-b81) Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b81, mixed mode)


Solution 1:

You are using Java 9 and not Java 8 how your JAVA_HOME will make you credible. The option was abolished with Java 8 and even ignored at this time. With Java 9 is no longer the case, the start is aborted. Therefore use Java 8 via

sudo update-alternatives --config java

and/or remove the entries MaxPermSize=350m in the files

/opt/android-studio/bin/studio64.vmoptions

and

/opt/android-studio/bin/studio.vmoptions

Note, I have Android Studio installed in /opt

Solution 2:

Both java versions that you have listed are different.

Try

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default

Then on terminal go to the folder where you have extracted Android Studio folder and then run the following commands:

cd android-studio/bin
./studio.sh