How To Fix “tools.jar” Error In Android Studio

Question:

After running ./studio.sh in a terminal from my Android Studio directory, I get this error below

'tools.jar' is not in android studio classpath Please ensure JAVA_HOME points to JDK rather than JRE.

astd

Install JDK:

sudo apt-get install openjdk-7-jdk

Set environment Variable:

sudo nano /etc/environment

Add the following line:

JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386

Reboot, and Android Studio starts up. (I had added also a link to studio.sh to the main menu).

First check if java JDK is installed correctly

dpkg --list | grep -i jdk

if not install by running the commands below:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-jdk7-installer

Enable JDK after installation

update-alternatives --display java

Check JDK version

java -version

If everything goes well you should see:

java_version

Now add JAVA_HOME to environment variable.

Edit /etc/environment and add JAVA_HOME using your prefered text editor

sudo vi /etc/environment

Now append:

For 32 Bits

JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386

For 64 Bits

JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64

Now ./studio.sh should run

studio.sh

Enjoy!