Sunday, 8 September 2013

Oracle JDK install on Ubuntu for Android Studio

# Android Studio recommends Oracle JDK over Ubuntu default
# Here are the steps to install Oracle JDK and make if default jvm

# go download the JDK from Oracle, then unpack
tar xzvf ~/Downloads/jdk-7u25-linux-x64.tar.gz

# make jvm directory, if necessary
sudo mkdir /usr/lib/jvm

# move the JDK there
sudo mv jdk1.7.0_25/ /usr/lib/jvm/

# set permissions
sudo chmod a+x /usr/bin/java
sudo chmod a+x /usr/bin/javac
sudo chmod a+x /usr/bin/javaws
sudo chown -R root:root /usr/lib/jvm/jdk1.7.0

# install with update-alternatives
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_25/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.7.0_25/bin/javac 1
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.7.0_25/bin/javaws 1

# select the oracle java version for each command below
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws

# make sure it worked
java -version

# make it work in firefox plugin
sudo ln -s /usr/lib/jvm/jdk1.7.0/jre/lib/amd64/ ~/.mozilla/plugins/
# N.B. you can link to /usr/lib/firefox/plugins/ for a system wide installation
# Src:

No comments:

Post a Comment