How to install Java on ubuntu

I am writing this post because I keep forgetting how to do it and end up trawling the web trying to find it. The Unbuntu starter guide should be the first port of call to install whatever flavour of java you want via apt.

Then this comes from [1]

If you want to use Sun’s Java instead of the open source GIJ (GNU Java bytecode interpreter) you need to set it as default. To list installed JVMs:

update-java-alternatives -l

To select, for example, Sun’s JVM as provided in Ubuntu 6.06, run:

sudo update-java-alternatives -s java-1.5.0-sun

You should also edit /etc/jvm and move /usr/lib/jvm/java-1.5.0-sun to the top of JVMs offered.

To set the JAVA_HOME environment variable I followed this [2]

export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun-1.5.0.08

You can find your JAVA_HOME using the locate command for a file belonging to the JDK.

locate /rt.jar
  1. Ubuntu: Installing Java :Turkey Dog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: