Java

From AzureusWiki

Jump to: navigation, search

How to update to the latest Sun Java version

Note: Using an old Java version, or having more than one installed, may cause severe problems like 100% CPU usage! If you have installed Azureus but it is behaving strangely (eg. no windows display after the program launches) you probably need to upgrade your Java.


The latest official Java is version 6 update 16 (1.6.0u16) as of September 2009.

You can check from Sun's web pages, if you have the newest java installed: Detect Java version


Contents

Windows

Sun's Java

Installing Java

You must be running as an administrator to be able to install Java successfully. If your regular user account is a limited user (following the best practices for safe computing), you will need to temporarily switch the account to an administrative user in order to install Java successfully. After Java is installed on that account, you can switch that account back to a limited user account.

Java troubleshooting issues

Outdated Java
  1. Hit the Windows-key and R, enter cmd /k java -version and hit OK to find out which JRE is currently installed (or visit Sun java web pages: Detect Java version)
  2. If your version is not the latest (see above) get it from Sun
    1. click on Download JRE 6
    2. on the next page, read the license agreement and click Accept if you accept it (you must accept it to continue)
    3. then click on Windows Offline Installation, Multi-language
    4. pay careful attention to WHERE you save the file.
  3. Shut down Azureus
  4. Uninstall every Java you may find in Start->Settings->Control panel->Add/remove Programs
  5. Reboot your PC (it's very important! Don't skip this!)
  6. Read How to clean the Windows registry after uninstalling old Java versions
  7. Install the latest Java JRE
More than one Java installed
  1. If you should already have the latest Java version check Start/Programs to see if there's more than one J2SE Runtime Environment.
  2. Shut down Azureus
  3. Uninstall every Java you may find in Start->Settings->Control panel->Add/remove Programs
  4. Reboot your PC
  5. Read How to clean the Windows registry after uninstalling old Java versions
  6. Install the latest Java again

Running with GCJ

GCJ is available for Cygwin in the gcc test release [1]. A MinGW version of GCJ is also available at this page. All this have not been verified.

Linux

To find out which version is installed, run the command java -version.

The following instructions will help you install Java, e.g., if you got back "command not found", or if you want to upgrade Java.

Running with GCJ

Azureus 2.4.0.0 and greater may run with GCJ 4.1.0 or greater, however some people experience problems which does not occur with the J2SE version.

Installing the Sun J2SE

On Ubuntu

If you are running Ubuntu Dapper Drake (6.06), you can install the Sun Java package directly from the Synaptic Package Manager: simply search for the sun-java5-bin package. Note you must have the multiverse repository enabled.

If you are running an earlier version of Ubuntu, you can upgrade to Dapper easily: see here.

If you still don't want to upgrade you can install Java using the Debian method listed below (you may want to remove the debian repositories from your sources.list afterwards, to avoid update conflicts).

On Debian

Debian Etch and the the preceding unstable and testing repos include a sun java package, which can be installed through your favorite package manager.


Earlier versions

Installing the Sun J2SE version of Java on Debian Sarge and older versions is a two step process. Due to licensing restrictings imposed by Sun, it is not legal to distribute convention Java packages. However, don't despair! The workaround is to download the Linux J2SE from Sun, and use a package builder to create a Debian package, and install that normally using dpkg.

You can use this same process over and over, as new versions become available from Sun. Check if the package is already installed like this:

dpkg -l sun-j2re\*
Getting required software

You will need the java-package package. You should be able to install it using apt-get install java-package (or aptitude install java-package).

If that doesn't work, check in /etc/apt/sources.list to make sure that you are getting the contrib part of the Debian archive. (Note that contrib is used for software which is itself free, but isn't really functional without non-free software.) If you see a line like this in /etc/apt/sources.list:

deb http://http.us.debian.org/debian/ stable main

change it to this:

deb http://http.us.debian.org/debian/ stable main contrib

Then run apt-get update (or aptitude update) and try again.

You will also need to download the Sun J2SE. Go to http://java.sun.com/j2se/1.5.0/download.jsp, find the link for the JRE 5.0 download, accept the license, and find the Linux self-extracting file. Do not get the RPM version. Download that file to any location, e.g., /usr/local/src.

Building the package

Go to the directory where you downloaded the Sun J2SE, and run the following command (you don't need to be root):

fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin

Note that the name of the jre-1_5_0* file may be different for you, if a later update has been released by Sun.

  • If you get an error similar to this:
"Creating temporary directory: /tmp/make-jpkg.XXXXrwGlbE
Loading plugins: blackdown-j2re.sh blackdown-j2sdk.sh common.sh
ibm-j2re.sh ibm-j2sdk.sh j2re.sh j2sdk.sh j2se.sh sun-j2re.sh
sun-j2sdk.sh

No matching plugin was found.
Removing temporary directory: done"

you may need to provide different debian architecture settings. First read man dpkg-architecture, and then use dpkg-architecture to view your settings. You may see something like

>dpkg-architecture
DEB_BUILD_ARCH=i386
DEB_BUILD_ARCH_OS=linux
DEB_BUILD_ARCH_CPU=i386
DEB_BUILD_GNU_CPU=i486
DEB_BUILD_GNU_SYSTEM=linux-gnu
DEB_BUILD_GNU_TYPE=i486-linux-gnu
DEB_HOST_ARCH=i386
DEB_HOST_ARCH_OS=linux
DEB_HOST_ARCH_CPU=i386
DEB_HOST_GNU_CPU=i486
DEB_HOST_GNU_SYSTEM=linux-gnu
DEB_HOST_GNU_TYPE=i486-linux-gnu
>

To build the package, specify an appropriate setting for the DEB_BUILD_GNU_TYPE (this will depend on what type of hardware you have). For example, use

DEB_BUILD_GNU_TYPE=i386-linux fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin

or

DEB_BUILD_GNU_TYPE=x86_64-linux fakeroot make-jpkg jre-1_5_0_06-linux-i586.bin

depending on your system.


make-jpkg will ask you a few questions, which you should answer to the best of your ability. Note that your name and email address will not be uploaded anywhere by make-jpkg, it is just asking you for data so that it can create a Debian package with correct attributions.

After you have answered the questions and agreed to Sun's license, make-jpkg will use the downloaded J2SE archive to create a Debian package. Once the process is done, install the Debian package in the conventional fashion, e.g.,

sudo dpkg -i sun-j2re1.5_1.5.0+update06_i386.deb

Again, the resulting *.deb filename may vary slightly for you. make-jpkg reports the name of the package when it's done.

Using the new Java

Depending on your setup, the java command might already point to the newly installed version, or it might be pointing to an old version. Test this using

java -version

If the version is reported as "1.5.0_06" or something close to that, you should be all set.

Otherwise, its likely that /usr/bin/java is pointing to some other version of Java which has been installed.

If you don't want to mess with /usr/bin/java (e.g., you need the old Java around for legacy reasons), you can just edit your azureus shell script. Near the top, change the line specifying JAVA_PROGRAM_DIR to

JAVA_PROGRAM_DIR="/usr/lib/j2re1.5-sun/bin/"

If on the other hand, you want to use the newly installed version for anytime you use java, you are going to need /usr/bin/java to point to /usr/lib/j2re1.5-sun/bin/java. However, if /usr/bin/java is not a symlink pointing to /etc/alternatives/java, then you are using the Debian alternatives mechanism to manage this sort of thing. It's best not to simply relink /usr/bin/java directly, but use the alternatives cleanly.

Note: if /usr/bin/java is not a symlink pointing to /etc/alternatives/java, then you are not using the alternatives system for Java, and the following instructions will not help you. You can just create the link directly.

To check what your system thinks is the correct Java, run this as root:

update-alternatives --display java

To modify what your system thinks is the best alternative, simply run

update-alternatives --config java

and select the binary located in /usr/lib/j2re1.5-sun/bin/java.

On Fedora Core

If you use Fedora Core and have problems with Azureus make sure that you install the latest Java using the rpm or the bin. Some users that used the rpm reported problems, in this case you should try again with the bin instead.

For most users, following this link will install Sun's Java quite nicely. Don't forget you may need to update your symlink for java, you can check which version is being used on the Help > About menu.

On RedHat Enterprise Linux ver 4 WS

If you use RHEL v4 WS and you have already installed java (check using rpm -qa java*), then you need to remove all packages first to install the version from www.sun.com.

To remove your installed java, take the output from rpm -qa java* and use rpm -e --test pkg_name to remove each package (replacing pkg_name with the actual name of the package(s)). The packages must be removed in a certain order; read the output of your rpm command for the correct order.

Next, goto http://java.sun.com/j2se/1.5.0/download.jsp, find the link for the JRE 5.0 download, accept the license, and find the linux RPM file (it will look something like "jre-1_5_0_06-linux-i586-rpm.bin"). Do not get the self-extracting version. After downloading the file, change to the directory where you downloaded it.

Make the file executable using chmod a+x jre-1_5_0_<version>-linux-i586-rpm.bin, and then run it using ./jre-1_5_0_<version>-linux-i586-rpm.bin. This will extract and run the RPM. The script will display a license agreement. Once you have agreed, the install script creates and runs an RPM file in the current directory. Once this is done Java should be installed, and you can safely delete the bin and rpm files if you wish.

Note: If you want to extract the RPM file but not install it, you can run the .bin file with the -x argument. You do not need to be root to do this.

Mac OS

J2SE 5.0 Release 4 (PPC): http://www.apple.com/support/downloads/j2se50release4ppc.html

J2SE 5.0 Release 4 (Intel): http://www.apple.com/support/downloads/j2se50release4intel.html
(both flavours require Mac OS X 10.4.5 or later)

Other Resources

Read the Azureus FAQ. See also: jar

Personal tools