Size: 19226
Comment: Added more detail about prerequisites
|
Size: 19936
Comment: 6.10 updates
|
Deletions are marked like this. | Additions are marked like this. |
Line 5: | Line 5: |
/!\ To install 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 sources.list. | /!\ To install propriatary 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 sources.list. |
Line 15: | Line 15: |
* '''Free Java:''' GNU classpath and others, these are already included in Ubuntu as of Ubuntu 5.10 | * '''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. |
Line 27: | Line 27: |
* There is no browser plugin for AMD64. You will need to install a 32bit version of Firefox. See below. |
|| SPARC ||<-3> GCJ || * There are no browser plugins for AMD64 and sparc. You will need 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 Free Java == Free Java is already installed in the default installation (''java-gcj-compat''). To install the development environment, install the ''java-gcj-compat-dev'' package. |
ContentsBRTableOfContents |
Prerequisites
To install propriatary 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 sources.list.
For more information about the Multiverse repository, please visit the following guide:
[:Repositories:Managing Repositories].
Introduction
Java is a technology from Sun Microsystems. There are several implementations, of which four will be talked about here:
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.
Sun Java: Sun Java is the reference implementation. As of Ubuntu 6.06, it is included in multiverse
Blackdown Java: Blackdown Java, another implementation, 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 |
|||
|
6.06 |
5.10 |
5.04 |
i386 |
Sun Java |
||
PPC |
IBM Java |
||
AMD64 |
Sun Java * |
||
SPARC |
GCJ |
* There are no browser plugins for AMD64 and sparc. You will need 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 Free Java
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 Sun Java
Ubuntu 6.06
Sun Java5: Install it from the Applications -> Add/Remove... menu making sure to check the unsupported and proprietary software checkboxes, or install the sun-java5-bin package.
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.
Kubuntu 6.06
- Sun Java5: Load up Konsole, and type:
sudo apt-get install sun-java5-bin
Accept the licence agreement that appears.
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 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.
Note: Scroll down to "Selecting the default Java version" section to enable the JRE you have installed.
Ubuntu/Kubuntu 5.10
Blackdown Java2 1.4: Enable multiverse and install the j2re1.4 package.
- Sun Java5: [:Java#head-12dfa90d1580b2a1d946cc628a1c0d2bdaa5b259:See below]
Ubuntu 5.04
- Sun Java5: [:Java#head-12dfa90d1580b2a1d946cc628a1c0d2bdaa5b259:See below]
Direct installation of Sun packages
Note: This is only for Ubuntu 5.10 and earlier. See above for 6.06
Download (with your browser is OK) the sun-java5-bin_1.5.0-06-1_i386.deb (or sun-java5-bin_1.5.0-06-1_amd64.deb for Amd64) and sun-java5-jre_1.5.0-06-1_all.deb from http://archive.ubuntu.com/ubuntu/pool/multiverse/s/sun-java5/ They will probably wind up on your desktop, which is OK. You can remove them from there when Java is up and running.
Install the unixodbc package. Preferably using Synaptic (System > administration > Synaptic package manager)
Open a terminal (program > tillbehör > terminal) and type sudo dpkg -i sun-java5-jre_1.5.0-06-1_all.deb (or copy, Ctrl+C, and paste, with Shift+Ins or middle-click)
Accept the license. It will fail, due to needing -bin, but you need to accept the license. You cannot install -bin first
Install the -bin with sudo dpkg -i sun-java5-bin_1.5.0-06-1_i386.deb (or sun-java5-bin_1.5.0-06-1_amd64.deb for Amd64) (Even this step will have some messages that seem to mean it hasn't worked, but after the next step it should be OK)
Run sudo dpkg --configure -a to configure the two java packages
Sun Java SDK (Software Development Kit)
Ubuntu 6.06
Sun Java5: Install it from the Applications -> Add/Remove... menu, or install the sun-java5-jdk package.
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.
Kubuntu 6.06
- 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.
Ubuntu/Kubuntu 5.10
Sun Java5: After running Direct installation of Sun packages, download sun-java5-jdk_1.5.0-06-1_i386.deb (or sun-java5-jdk_1.5.0-06-1_amd64.deb for Amd64). Install with sudo dpkg -i sun-java5-jdk_1.5.0-06-1_i386.deb (or sun-java5-jdk_1.5.0-06-1_amd64.deb for Amd64)
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.
Ubuntu/Kubuntu 5.04
Sun Java5: After running Direct installation of Sun packages, download sun-java5-jdk_1.5.0-06-1_i386.deb (or sun-java5-jdk_1.5.0-06-1_amd64.deb for Amd64). Install with sudo dpkg -i sun-java5-jdk_1.5.0-06-1_i386.deb (or sun-java5-jdk_1.5.0-06-1_amd64.deb for Amd64)
Selecting the default Java version
In Ubuntu 6.06 or 5.10, 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.
Manual method: Run:
sudo update-alternatives --config java
and select your preference from the list.
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.
Java on Konqueror
You may find that Java is disabled, even though it is set up correctly in the "Configure Konqueror" Dialog. Select "HTML Settings->Java" from the Tools menu to enable it.
Java on Mozilla Firefox
Ubuntu 6.06/Kubuntu 6.06
Sun Java5: Install it from the Applications -> Add/Remove... menu (Ubuntu only), or install the sun-java5-plugin package.
Ubuntu/Kubuntu 5.10
Sun Java5: After running Direct installation of Sun packages, download sun-java5-plugin_1.5.0-06-1_i386.deb . Install with sudo dpkg -i sun-java5-plugin_1.5.0-06-1_i386.deb
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.
Ubuntu/Kubuntu 5.04
Sun Java5: After running Direct installation of Sun packages, download sun-java5-plugin_1.5.0-06-1_i386.deb . Install with sudo dpkg -i sun-java5-plugin_1.5.0-06-1_i386.deb
amd64: Installing the Mozilla/Firefox plugin
Note: You should install the rest of Java by one of the above methods.
Note2: The following instructions for creating a link for the plugin do not need to be carried out if running Ubuntu 6.06 amd64 with latest updates as of kernel 2.6.15-26 (2006-08-19). I installed j2re-1.4.2 today with the firefox plugin from multiverse and Java worked in Firefox 1.5.0.5 immediately without having to create manual links.
Providing the Mozilla/Firefox plugin is available in your distribution of the JRE (currently Sun's doesn't include it), you can create a symbolic link to it inside the Mozilla and Firefox plugins directories. Apparently copying the plugin will not work. The installation directory will vary depending on whether you installed using method one or two, so both are documented below: For method one:
$ sudo ln -sf /usr/local/j2re-1.4.2/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/libjavaplugin.so
$ sudo ln -sf /usr/local/j2re-1.4.2/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin.so
Or for method two:
$ sudo ln -sf /usr/lib/j2re1.4-blackdown/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins/libjavaplugin.so
$ sudo ln -sf /usr/lib/j2re1.4-blackdown/plugin/amd64/mozilla/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin.so
1 - Install suport for 32 bit applications :
- sudo apt-get install ia32-libs ia32-libs-gtk linux32
2 - Download firefox 32 bit version from www.getfirefox.com
http://www.mozilla.com/products/download.html?product=firefox-1.5&os=linux&lang=en-US
(Another kind of installation is in FirefoxNewVersion which however differs in some details (installs into /opt; replaces regular /usr/bin/firefox with a new command), but I never tested :S )
3 - Untar the downloaded file like you allways do in Ubuntu, and go inside the directory :
- cd ~/Desktop/firefox
(or go where the uncompressed file is)
4 - Create a folder for the 32 bit firefox installation, and copy firefox there :
- mkdir /usr/local/firefox32 cp -r -p ./* /usr/local/firefox32/
5 - Create the execution files for 32 bit firefox :
- sudo nano /etc/pango32/pangorc
- Next add this text to the file :
- [Pango]
ModuleFiles=/etc/pango32/pango.modules [PangoX]
AliasFiles=/etc/pango/pangox.aliases
sudo nano /usr/local/bin/firefox32 &
- #!/bin/sh export GTK_PATH=/usr/lib32/gtk-2.0 export PANGO_RC_FILE=/etc/pango32/pangorc linux32 /usr/local/firefox32/firefox $@
- [Pango]
6 - Make it executable :
- sudo chmod +x /usr/local/bin/firefox32
7 - Check if your new 32 bit firefox is working :
firefox32 &
(it says warnings but doesn't matter)
11 - To install Java player to run applets, go to http://www.java.com, and download the linux self stracting file for 32 bit linux computers (I was surprised to see than this file works in amd64 bits Breezy installation) :
12 - To install java :
- sudo bash chmod 777 ./jre-1_5_0_06-linux-i586.bin
(this file name will depend on the java version you download)
- /jre-1_5_0_06-linux-i586.bin
(it will ask you some questions) mkdir /usr/local/java32 cp -r -p ./jre1.5.0_06/* /usr/local/java32 cd /usr/local/firefox32/plugins/ ln -s /usr/local/java32/plugin/i386/ns7/libjavaplugin_oji.so ./
13 - Restart firefox32 and check if java is working :
firefox32 &
14 - Visit : http://www.java.com/en/download/installed.jsp
15 - Add an icon at the top panel to start this 'cool' browser :
- Click with the right button at the top panel Choose : Add to panel Choose : Custom application launcher, and press 'Add' button
- Name : firefox32 Generic name : Firefox 1.5 32 bits Comment : Firefox with 'Flash' and 'Java' Command : firefox32 Type : Application Icon : /usr/share/pixmaps/mozilla-firefox.png
16 - Enjoy the net !
PowerPC
IBM produces a Java Development Kit (JDK) for its POWER computers, which happens to also work on PPC. They are the only place to make available recent versions of Java for PPC Linux. Their recent versions consist of versions 1.5.0 and 1.4.2 of Java. They also have a 1.3.1 version, but there is no reason to use that. This page will not discuss the use of IBM's 1.3.1 version.
The 1.4.2 JDK is known to work on G3, G4, and G5 Macs, as well as older 604e and 603e Macs. The 1.5.0 JDK is known to work on G3, G4, and G5 Macs, and it is not yet known whether it works on older 604e and 603e Macs. It is not yet known whether either one works on non-Mac PowerPCs. Please update the Wiki if you have more information!
To get IBM's JDK, go to http://www-128.ibm.com/developerworks/java/jdk/linux/download.html, and choose an SDK for 32-bit iSeries/pSeries. Be sure to get the 32-bit version even if you have a G5. You may choose to download both the latest 1.5.0 and 1.4.2 versions and install both if you wish. In any case, periodically check that page for newer Service Releases, and repeat the process described here whenever there is a new one. There is currently no way to keep track of which Service Release you are on under Ubuntu, so make a note of it. As of this writing, SR2 is the latest of the 1.5.0, and SR5 is the latest of the 1.4.2 version. You will have to register before being allowed to download anything. When you reach the download page, download the TGZ version of the SDK.
Installation Process
To use the TGZ with Ubuntu, you have to convert it to a DEB. Make sure you have the tool make-jpkg installed from the Multiverse repository (See ["AddingRepositoriesHowto"]):
sudo apt-get install java-package
If you are still using Breezy Badger, you will now need to upgrade the version of the package you just installed. To do this, download [http://archive.ubuntu.com/ubuntu/pool/multiverse/j/java-package/java-package_0.27_all.deb this file] to your desktop and type:
cd ~/Desktop sudo dpkg -i java-package_0.27_all.deb
Now convert the 1.4.2 TGZ and install the resulting DEB:
make-jpkg IBMJava2-SDK-142.ppc.tgz sudo dpkg -i ibm-j2sdk1.4_1.4.2_powerpc.deb
Now convert the 1.5.0 TGZ and install the resulting DEB:
make-jpkg ibm-java2-sdk-50-linux-ppc.tgz sudo dpkg -i ibm-j2sdk1.5_1.5.0_powerpc.deb
Note on libraries: the IBM Java binaries depend on libstdc++5 and libgtk1.2 packages. At least in Dapper it's possible that these libraries are not installed. In this case, make-jpkg will give a lot of warnings about not being able to find dependecies for library files. To get the dependencies set correctly (and to get the Java to work at all), make sure you have installed libstdc++5 and libgtk1.2 before issuing the make-jpkg command.
To set the new JRE or JDK as the default, you may need to update your Java alternatives. Run the following command then, when prompted, choose your preferred Java environment from the list. If update-alternatives tells you that there is only one Java environment, continue onward! If you chose to install both 1.4.2 and 1.5.0 versions, you may run this command at any time to switch the one subsequently opened Java applications will use. The one that the Firefox and Opera web browsers use will be unaffected. Which one the Konqueror web browser uses, and whether or not it would be affected, depends on your KDE system settings.
sudo update-alternatives --config java
If you installed a 1.4.2 version, regardless of whether or not you installed a 1.5.0 version, and your processor is not a G5, you must perform yet another step to get it to work. For a G3 or G4, use the following command:
sudo sh -c 'echo "JITC_PROCESSOR_TYPE=6" >> /etc/environment'
For a 604e or 603e, instead use:
sudo sh -c 'echo "JITC_PROCESSOR_TYPE=5" >> /etc/environment'
You may have to log out or restart the computer for this to take effect.
Note: In the GNOME environment of Ubuntu 6.06 LTS/Dapper Drake, it may be possible that changing language selections may overwrite this file, causing a 1.4.2 version of IBM Java to stop working completely. Please share such experiences, if any, on this wiki.
IF you installed the JDK, the following code tests that everything's working. Open a terminal, and try this for version 1.4.2:
cd /usr/lib/j2sdk1.4-ibm/demo/applets/TicTacToe ../../../bin/appletviewer example1.html
To try version 1.5.0:
cd /usr/lib/j2sdk1.5-ibm/demo/applets/TicTacToe ../../../bin/appletviewer example1.html
If you see a Tic Tac Toe game, it worked! If you installed the JRE, you don't have an appletviewer or any demos so try whichever program it was that led you to install java in the first place!
Neither the Firefox web browser nor the full Mozilla suite can use version 1.4.2, but they can use 1.5.0 if you configure as follows:
mkdir -p ~/.mozilla/plugins cd ~/.mozilla/plugins ln -s /usr/lib/j2sdk1.5-ibm/jre/bin/libjavaplugin_oji.so
To control which Java the Konqueror web browser uses, go to your KDE system settings. Select Internet & Network -> Web Browser -> Java & JavaScript, and change the Path to Java executable to either /usr/lib/j2sdk1.4-ibm/bin/java or /usr/lib/j2sdk1.5-ibm/bin/java.
To control which Java the Opera web browser uses, go to Tools -> Preferences -> Advanced -> Content -> Java options, and change the path to either /usr/lib/j2sdk1.4-ibm/jre/bin or /usr/lib/j2sdk1.5-ibm/jre/bin.
Test the installation at the Sun Java [http://www.java.com/en/download/help/testvm.xml test webpage].
work-arounds
ppc: bug #343837
? ln -s /usr/lib/j2sdk1.5-ibm/jre/bin/libjavaplugin_oji.so /usr/lib/mozilla-firefox/plugins ?