Friday, January 28, 2005

Java on Ubuntu

Follows abstract from ubuntulinux.org

Due to Non-Free status of most Java implementations, Ubuntu does not include Java support natively.

In the repository you can find the latest Sun JRE and Sun JDK prebuilt for Ubuntu Warty. At the moment there is Sun JRE/JDK 1.4.2_06, Sun JDK 1.5.0 (package from above source) and Sun JRE/JDK 1.5.0 Update 1.

deb http://ubuntu.tower-net.de/ubuntu/ warty java

If you have not done already, you must add the multiverse repository for one dependency, too:

deb http://archive.ubuntu.com/ubuntu/ warty multiverse

The package is called somathing like sun-j2sdk1.5 (to find out its actual name do a search in synaptic for 'sun-j2' or type 'sudo apt-cache search sun-j2'.

Alsoe look at this for a generic aproach:
http://www.ubuntulinux.org/wiki/AddingJavaSupport

  1. Download jre-1_5_0_01-linux-i586 from here http://java.sun.com/j2se/1.5.0/download.jsp (Update 1)

  2. $ cd browse_to_your_download_folder
    $ sh jre-1_5_0_01-linux-i586.bin
    $ sudo mkdir /usr/java
    $ sudo mv jre1.5.0_01/ /usr/java/
    $ sudo chown -R root:root /usr/java/jre1.5.0_01/
    $ sudo ln -s /usr/java/jre1.5.0_01/bin/java /usr/bin/java
    $ sudo ln -s /usr/java/jre1.5.0_01/bin/java_vm /usr/bin/java_vm
    $ sudo gedit /etc/bash.bashrc

  3. add this to the bash.bashrc

    JAVA_HOME=/usr/java/jre1.5.0_01
    export JAVA_HOME
    PATH=$PATH:$JAVA_HOME/bin
    export PATH

    then save it.

  4. Then to make sure it works type this: java -version

  5. Adding Java Support to Firefox 0.93 (as delivered with Warty):

  6. $ cd /usr/lib/mozilla-firefox/plugins
    $ sudo ln -s /usr/java/jre1.5.0_01/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so