Thursday, November 20, 2014

Installing Java JDK on Ubuntu

I am working on getting vert.x (http://vertx.io/) to run in a lab environment as part of my end-to-end troubleshooting effort.    The binary version of vert.x requires JDK to run.

Therefore, I found myself in need to having a working JDK install on my fresh Ubuntu Server 14.0.4.1.


Essentially, I run these commands.  (Detail manual configuration can be done, but I love this short and simple method)

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default

or 



sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default

Initially I have a problem with ‘add-apt-repository’ command not found, but the solution is outlined here - http://ubuntuforums.org/showthread.php?t=1971357

The ‘add-apt-repository’ is part of either one of these packages.

sudo apt-get install python-software-properties
sudo apt-get install software-properties-common


So, it is as simple as this!   I like it.

---

For Debian
Ref: http://stackoverflow.com/questions/15543603/installing-java-7-oracle-in-debian-via-apt-get

echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt-get update
apt-get install oracle-java7-installer