Monday, May 20, 2013

Getting started with Android Studio on Ubuntu 12.04 - tools.jar missing

I tried installing and running Android Studio, but came across the error: "tools.jar missing from classpath. Please ensure that JAVA_HOME points to the JDK, not the JRE."

I tried the following:
Finding where java is installed:
  $: whereisjava
  $: java -version
  $: echo $JAVA_HOME
  $: echo $JDK_HOME

For Ubuntu, normally the openjdk version of Java is used.

Editing and saving ~/.bashrc
$: nano ~/.bashrc
JAVA_HOME =  /usr/lib/jvm/java-7-openjdk-amd64/
export JAVA_HOME
JDK_HOME = /usr/lib/jvm/java-7-openjdk-amd64/
export JDK_HOME

Reloading ~/.bashrc
$: source ~/.bashrc
$: echo $JAVA_HOME
$: echo $JDK_HOME

Check for the correct version of Java if you are like me, having both Java 6 and 7 installed.

sudo update-alternatives --config java

Choose the correct version of Java.


No comments:

Post a Comment