There's an official ubuntu "JEOS" distribution, it's trimmed down and designed exclusively to run as a guest OS in a virtualised environment.
Installing the oracle JVM on a vanilla ubuntu install is easy:
- Download the latest jdk from Oracle in .tar.gz format
- Extract the archive with tar xzvf jdk.XXX.tar.gz
- Move the JDK into the correct place for Ubuntu:
sudo mkdir /usr/lib/jvm
sudo mv jdkXXXX /usr/lib/jvm
- Update the alternatives system to reflect the newly installed JDK. There were too many commands to do manually so i created a for loop in bash which filters out only the commands i wanted to register with the system:
for cmd in /usr/lib/jvm/jdk1.7.0_09/bin/[jkpr]*; do
cmd=$( basename $cmd )
echo "Registering $cmd with the system alternatives mechanism..."
sudo update-alternatives --install /usr/bin/$cmd $cmd /usr/lib/jvm/jdk1.7.0_09/bin/$cmd 1
I used and to confirm these were
If this is not the only JDK installed on your Ubuntu server, you may run into
an unexpected version being returned in the above test, in that case you can
and repeat for each command
sudo update-alternatives --config java
(you could alter the above for-loop).
Of course, this is all a bit crappy doing manually. Better options exist: package the jvm yourself, or use something like puppet to orchastrate the install & other configuration of the machine(s)