Install the jdk in Debian

First downt load the jdk from sun web sit:www.sun.com
seconed
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/*
[ edit]
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
actention:My setting is
deb http://ftp.us.debian.org/debian sarge main contrib non-free

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.

[ edit]
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.

[ edit]
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.

[ edit]
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.

[ edit]
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.


[ edit]

Installing Java from Blackdown

Blackdown also provides Linux Java software. Currently they only have Java version 1.4, which will work with Azureus but is not optimal.

You will only need the Runtime packages, not the whole Java SDK.

[ edit]
On Debian

Debian packages are provided by Blackdown. To install them, add the following to /etc/apt/sources.list:

deb http://www.tux.org/pub/java/debian sarge non-free

If you are not running Debian Sarge (3.1), enter etch or testing or unstable, as appropriate.

Next, run apt-get update (or aptitude update) and apt-get install j2re1.4 as root.

The package also includes a Mozilla plugin, called "libjavaplugin_oji.so". However, note that the Java browser plugin is extremely sensitive to the version of gcc used to compile Mozilla, so you may find this not to work. The Sun J2SE may give you better results (see above).

[ edit]
On other distributions

To install the Blackdown Java packages directly, see the instructions at http://www.blackdown.org/java-linux/java2-status/jdk1.4-status.html and http://www.blackdown.org/java-linux/java2-status/INSTALL-1.4-j2re .

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值