6

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?

Max
  • 163
  • Try this, replace /opt/android-studio with the correct path: sudo chmod g+r,o+r /opt/android-studio/lib/bootstrap.jar And give me a ping with @A.B. – A.B. Jun 01 '15 at 18:06
  • @A.B. my android-studio does not have bootstrap.jar and my android studio in at home/random_folder, does it have to be at /opt/android-studio? – Max Jun 01 '15 at 18:28
  • No bootstrap.jar?! Which version is installed? And no, it doesn't have to be at /opt/android-studio – A.B. Jun 01 '15 at 18:31
  • Correct the owner of the installation: chown -R $USER:$USER ~/<your_android_studio_folder>/. Don't forget the trailing /. – A.B. Jun 01 '15 at 18:33
  • @A.B. Actually I just noticed that in /opt/intellij-idea-ce/ I have intellij installed, I can run it by running bin/idea.sh, I added that the /bin path in PATH also, but still android studio wont run. Any idea – Max Jun 01 '15 at 18:39
  • Add the complete path of your studio.sh command. – A.B. Jun 01 '15 at 18:43
  • @A.B. yeah on running android studio that is the error I am getting, that can't main itellij.idea.main – Max Jun 01 '15 at 18:43
  • 1
    If someone has this issue, try extracting the downloaded Zip again and make sure all the files are extracted correctly. If you are moving the directory, make sure it moves completely. In my case, the directory was moved before the file was uncompressed completely (dooh! +1 Homer point) – Timothy C. Quinn Jan 08 '18 at 02:00

1 Answers1

5

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.

Fabby
  • 34,259
A.B.
  • 90,397
  • android-studio/lib/ directory doesn't exist for me. Should I create it and move bootstrap.jar into it ? If yes : what .jar should I download ( http://www.java2s.com/Code/Jar/b/Downloadbootstrapjar.htm ) ? I have Ubuntu 18.04 and these Java SDK : https://textuploader.com/d2vu3 . – JarsOfJam-Scheduler Sep 04 '18 at 17:20