Ubuntu – Can’t launch android-studio in linux, getting this error Error: Could not find or load main class com.intellij.idea.Main

android-studio

I just downloaded android studio and I am trying to launch it by running studio.sh file, I am getting this error

Error: Could not find or load main class com.intellij.idea.Main
I have looked it up on so and other sites and they all suggest to set the path correctly,

I have installed java and set up both Java_Home and PATH

JAVA_HOME =/usr/local/java/jdk1.7.0_40
PATH= /usr/local/java/jdk1.7.0_40/bin(part of the total path variable)

here is the output of java-version

java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

Can anyone point out what I am doing wrong?

Best Answer

Either the file <your_installation_path>/android-studio/lib/bootstrap.jar does not exist or has the wrong ownership.

Because the installation is located in your home directory, execute the following command that will give your user ownership:

sudo chown -R $USER:$USER <your_installation_path>/android-studio/

If that does not work, check if the file android-studio/lib/bootstrap.jar exists. If not, then download and extract the archive again.