Prerequisites
To install OpenJDK, you must have the Universe repository enabled and be running Ubuntu 8.04 or later.
/!\ To install proprietary Java, you must have the Multiverse repository enabled. Keep in mind that this repository is different from the backports Multiverse repository. That is, do not simply uncomment the "multiverse" line for backports. Instead, you will need to add "multiverse" to the existing main line in /etc/apt/sources.list.
To install IcedTea, you must have the Universe repository enabled and be running Ubuntu 7.10 or later.
For more information about the Multiverse and Universe repositories, please visit the following guide:
Managing Repositories.
Introduction
Java is a technology from Sun Microsystems. There are several implementations, of which five will be talked about here:
*
OpenJDK: The primary goal of the OpenJDK project is to produce an open-source implementation of the Java SE 6 Platform. As of Ubuntu 8.04, it is located in the universe repository.
*
Free Java: GNU classpath and others, these are already included in Ubuntu as of Ubuntu 5.10. These implementations are available for all supported Ubuntu architectures.
*
IcedTea: IcedTea is a build of OpenJDK from Red Hat that is composed of free software. As of Ubuntu 7.10, it is located in the universe repository.
*
Sun Java: Sun Java is the reference implementation. As of Ubuntu 6.06, it is included in multiverse
*
Blackdown Java: Blackdown Java, a port of the Sun JDK to Linux which pre-dates Sun's official port, is included in multiverse of Ubuntu 5.10 and later
*
IBM Java: IBM Java is a reimplementation with a Just-In-Time Compiler. It is only available from IBM's website. It is the preferred Java solution on PowerPC machines, and instructions for Ubuntu on PowerPC are below. It is also available for i386 and AMD64, but use on such installations is not discussed here.
Java is also very different based on your processor architecture. Most computers are i386, Mac are PowerPC (although newer MacBooks and MacBook Pros are i386) and some newer computers are AMD64. Use the following chart to see which version of Java you should install:
Release
Free Java
Proprietary Java
8.04
7.04
6.10
6.06
7.04
6.10
6.06
i386
OpenJDK or GCJ
Sun Java
PPC
GCJ
IBM Java
AMD64
OpenJDK or GCJ
Sun Java *
SPARC
GCJ
-
*
There is no browser plugin for the SPARC platform. On the AMD64 platform, the icedtea-gcjwebplugin is a browser plugin without LiveConnect support. For a more complete plugin, you will have to install a 32bit version of Firefox. See below.
*
Starting with Ubuntu 6.10 (EdgyEft), you can install the experimental java-gcj-compat-plugin from the universe archive. It is available on all architectures. Note however, that the plugin currently runs with no security manager. This means that applets you load can do anything a java application that you download and run can do. Be **very** careful which applets you run.
Installing OpenJDK
OpenJDK is available on Ubuntu 8.04 in the Universe repository. The runtime environment is located in the openjdk-6-jre package.
Installing GCJ
Free Java is already installed in the default installation java-gcj-compat. To install the development environment, install the java-gcj-compat-dev package.
Installing IcedTea
IcedTea is available on Ubuntu 7.10 in the Universe repository. The runtime environment is located in the icedtea-java7-jre package.
Installing Sun Java
Ubuntu 7.04 or later
*
Sun Java6: sun-java6-bin, sun-java6-jre
*
Blackdown Java2 1.4: j2re1.4
Ubuntu 6.06 / 6.10
*
Sun Java5: sun-java5-bin, sun-java5-jre
*
Blackdown Java2 1.4: j2re1.4
Kubuntu 6.06 / 6.10
* Sun Java5: Load up Konsole, and type:
sudo apt-get install sun-java5-bin
Accept the licence agreement that appears.
{i} Note: The license may not come up and will cause the package installation to fail, to fix this, do the following:
* In a terminal, type
sudo apt-get install libqt-perl
sudo dpkg-reconfigure debconf
* The first command will install the needed package for debconf-kde counterpart. The second command will ask a few questions: For the first step, choose "kde". For the second step, choose "high". Then, to fix the packages that did not correctly install, do:
sudo apt-get -f install
* then you are done.
*
Blackdown Java2 1.4: j2re1.4
{i} Note: Scroll down to "Selecting the default Java version" section to enable the JRE you have installed.
Sun Java SDK (Software Development Kit)
Ubuntu 8.04
*
OpenJDK: openjdk-6-jdk
Ubuntu 7.10
*
IcedTea: icedtea-java7-jdk
Ubuntu 7.04
*
Sun Java6: sun-java6-jdk
Ubuntu 6.06 / 6.10
*
Sun Java5: sun-java5-jdk
Kubuntu 6.06 / 6.10
* Sun Java5: Load up Konsole, and type:
sudo apt-get install sun-java5-jdk
Accept the licence agreement that appears.
*
Blackdown Java2 1.4 packages: Install the j2re1.4 package, available in the multiverse repositories. Install it from the Applications -> Add/Remove... menu, or install the j2re1.4 package.
Selecting the default Java version
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.
Adding JDK 1.4 as an alternative
The Blackdown JDK 1.4 does not automatically appear as an alternative upon installation. In order to make it appear, you'll need to create a file such as /usr/lib/jvm/.java-1.4.2-sun.jinfo as described in the man page for update-java-alternatives. Note: the default install location is /usr/lib/j2se/1.4
Manual method: Run:
sudo update-alternatives --config java
and select your preference from the list.
{i} Note: You probably want to do the same with jar, javac, javadoc, javah, javap and javaws:
sudo update-alternatives --config jar
To get common java applications (installed using .deb-packages) to run under your JVM of choice, make sure you also edit the JVM configuration file:
sudo nano /etc/jvm
and add the line:
/usr/lib/j2sdk1.5-sun
Packages such as ant starts the first JVM found in this file.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment