Malcom:Ubuntu:Java

From SubfireWiki

Jump to: navigation, search

Contents

Ubuntu Java

Common Packages

sudo apt-get install fakeroot java-package java-common

Java Install

There are a couple of ways to install Java, but I find the best is to simply download the .bin from Sun directly and perform the following two commands:

fakeroot make-jpkg jdk-1_5_0_06-linux-i586.bin
sudo dpkg -i sun-j2sdk1.5_1.5.0+update06_i386.deb

Substituting the correct file name for the .bin file and corresponding .deb file.

Default Java

Use update-alternatives to change the /usr/bin/java to the correct java version.

sudo update-alternatives --config java
  • From the man page for update-alternatives:

"update-alternatives creates, removes, maintains and displays information about the symbolic links comprising the Debian alternatives system."

JAVA_HOME

It's a good idea to set the environment variable JAVA_HOME in either your .bashrc or .bash_profile:

export JAVA_HOME='/usr/lib/j2sdk1.5-sun'

Another approach is to make a symbolic link say at /usr/local/java or /usr/lib/j2sdk that points the version of Java that's your default, and then point JAVA_HOME to that symbolic link. That way, you just have to switch the symobolic link and you don't have to muck around with the JAVA_HOME variable.

ANT

sudo apt-get install ant ant-doc


Java Plugin

If there's nothing there or the one you want isn't; then you can do something like this:

cd /home/username/.mozilla/plugins
ln -s /usr/lib/j2re1.5-sun/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so
sudo ln -s /usr/lib/j2re1.5-sun/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/
Personal tools