Error to run Android Studio
I have installed Android Studio and I followed all steps described here
But when I start studio.sh
I got an error with this message:
'tools.jar' is not in Android Studio classpath. Please ensure JAVA_HOME points to JDK rather than JRE
Can anyone here help me with this?
Solution 1:
Check if your Java JDK is installed correctly
dpkg --list | grep -i jdk
If not, install JDK
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-java8-installer
After the installation you have to enable the jdk
update-alternatives --display java
Check if Ubuntu uses Java JDK 8
java -version
If all went right the answer should be something like this:
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)
Check what compiler is used
javac -version
It should show something like this
javac 1.8.0_91
Finally, add JAVA_HOME to the environment variable
Edit /etc/environment
and add JAVA_HOME=/usr/lib/jvm/java-8-oracle
to the end of the file
sudo nano /etc/environment
Append to the end of the file
JAVA_HOME=/usr/lib/jvm/java-8-oracle
You will then have to reboot, you can do this from the terminal with:
sudo reboot
In case you want to remove the JDK
sudo apt-get remove oracle-java8-installer
Solution 2:
sudo apt-get install default-jdk
That's all in ubuntu 11
Solution 3:
This is caused by having JAVA JRE installed as opposed to JAVA JDK.
The solution is simple:
sudo apt-get install openjdk-7-jdk
http://www.maxmakedesign.co.uk/development/2013/android-studio-tools-jar-classpath/