website stat

Ubuntu default Java Runtime

Attention: Ubuntu uses gcj and gci as the default java runtime environment. Result: half of the things you try to run in java are broken.

To install Sun’s Java SDK just add this to your /etc/apt/sources.list


deb http://ubuntu.tower-net.de/ubuntu/ hoary java
deb http://archive.ubuntu.com/ubuntu/ hoary multiverse

And then update your symbolic links of all the java binaries under /etc/alternatives. This is done by doing update-alternatives java as root. Breezy automatically updates this but you’d better run it if you’re using Hoary or prior versions of Ubuntu. Done.


6 Responses to “Ubuntu default Java Runtime”

  1. psi-
    Published at October 4th, 2005 at 9:50 pm

    Please run ‘man update-alternatives’ and then as root ‘update-alternatives java’. Maybe then you’ll not fuck up your system.

  2. mlopes
    Published at October 4th, 2005 at 11:34 pm

    Well, manually changing the symbolic links worked fine, but thank you for your suggestion, it is the way politically correct of doing things :-) Same applies to update-rc.d (instead of manually linking init.d scripts to rcX.d).

  3. tool462
    Published at December 5th, 2005 at 11:26 pm

    hmmm, that’s all well and good, but i’m not sure what symbolic links are, can someone point me in the right direction, i just got j2re installed.

  4. mlopes
    Published at December 6th, 2005 at 12:23 am

    tool462,

    Forget that, just do update-alternatives java as root after installing j2re.

  5. Nibuzer
    Published at February 17th, 2006 at 1:06 pm

    I got the J2ee installed but when I execute sudo update-alternatives –config java I only see this :

    douglas@PortableDouglas:~$ update-alternatives –config java

    There are 2 alternatives which provide `java’.

    Selection Alternative
    ———————————————–
    * 1 /usr/bin/gij-wrapper-4.0
    + 2 /usr/lib/jvm/java-gcj/bin/java

    Press enter to keep the default[*], or type selection number:
    douglas@PortableDouglas:~$

    nothing about the jre I installed with j2ee

  6. mesut
    Published at March 27th, 2007 at 7:16 am

    try
    apt-get install sun-java6-bin