手动打包sun java jdk [Installing the latest JDK on Debian by creating a .deb package from Sun binaries]

本文介绍了如何在Debian系统中通过手动打包Sun JDK的.bin文件为.deb包,以便安装最新版本的JDK。由于Debian非免费库中的JDK不总是最新,因此需要下载JDK二进制文件,使用java-package和fakeroot将其转换为.deb包。在过程中可能会遇到'Plugins not found'错误,但可以通过编辑sun-j2sdk.sh脚本解决。最后,作为root用户安装.deb包,并配置为默认JDK。
摘要由CSDN通过智能技术生成

Installing the latest JDK on Debian by creating a .deb package from Sun binaries



Normally we download Sun JDK installation binaries and install them. Then we configure the PATH environment variable to point to our JDK installation. But some times there will be conflicts between the native gcj and Sun JDK. So it is always better to install Sun JDK through debian repositories.

But unfortunately, the Debian repositories have Sun JDK in non-free repositories and do not always have the latest JDK.

So this is how we can install the latest JDK natively on Debian.

Steps to be followed: 

1. We have to download the JDK or JRE binaries (a .bin file) appropriate for our architecture.

2. Then we have to create a .deb package from the Sun JDK binaries we have downloaded

\*Requirements:

  a.Install java-package which will help us to convert the Sun JDK .bin file to a  .deb file installable on Debian.

  b. Install fakeroot. 

3. Then do as non-root user,

 fakeroot make-jpkg <Sun JDK binary filename>

If there is an error like 'Plugins not found' or similar errors, it means that the version of the Sun JDK you are trying to install may not be supported by 'java-package'. Fortunately, there is a work-around for this:

Edit usr/share/java-package/sun-j2sdk.sh like this:     #这一步我在debian wheezy上没有做,也能打包成功。

Add the following to that file:

"<Your Sun JDK/JRE bin file name") # SUPPORTED
j2se_version=1.6.0+update<version>${revision}
j2se_expected_min_size=130
found=true
;;

at the end of the list of similar directives for various versions of JDK/JRE and save the file.

Now repeat step 3 and it will not give the 'Plugins not found error' and a .deb package will be created with some warnings which you can ignore safely.

4. Then install the .deb file as a root user by the command:

dpkg -i <generated .deb file name>

5. After the JDK is installed, we have to configure the installed Sun JDK as the default JDK. So we use the following commands:

 update-alternatives --config java

 This command will show a list of Java installations available (including gcj) and prompt for a choice.

Choose the choice which corresponds to your Sun JDK installation. In my case it was something like this:

/usr/lib/j2sdk1.6-sun/bin/java

Now your Sun JDK installation will be the default JDK. :-)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值