Ubuntu: Installing java the easy way
This guide will help you install the sun java version without having to deal with fakeroot.
Edit your /etc/apt/sources.list file
Add the following (if not already there)
deb http://us.archive.ubuntu.com/ubuntu dapper main restricted
deb http://us.archive.ubuntu.com/ubuntu dapper universe multiverse
Run:
sudo apt-get update
and
sudo apt-get install sun-java5-jdk
Accept the license agreement
If you have already installed an older java version run:
sudo update-alternatives –config java
and chose the appropriate version:
msti@msti:~$ sudo update-alternatives –config java
There are 3 alternatives which provide `java’.
Selection Alternative
———————————————–
1 /usr/bin/gij-wrapper-4.1
*+ 2 /usr/lib/jvm/java-gcj/jre/bin/java
3 /usr/lib/jvm/java-1.5.0-sun/jre/bin/java
Press enter to keep the default[*], or type selection number: 3
Using `/usr/lib/jvm/java-1.5.0-sun/jre/bin/java’ to provide `java’.
April 19th, 2007 at 11:41 am
What about setting up the $JAVA_HOME variable. Wouldn’t java apps have problem if you don’t set this variable.
Cheers
–arky
April 19th, 2007 at 2:30 pm
Thanks for your note arky!
It depends on the apps you want to use.
In my case, I dont need the JAVA_HOME var, because the apps I use dont need it (aqua data studio, jedit, eclipse)
For apps like tomcat, the $JAVA_HOME variable is needed. You can manually set the $JAVA_HOME path in your /etc/bash.bashrc file like this:
JAVA_HOME=”PATH_TO _YOUR_JAVA_INSTALLATION”
export JAVA_HOME
Mike.