ubuntu下jre配置

Installing JRE

First, decide on which architecture will be installed, and download the relevant file from the main Java website – if you’re running a 64 Bit Linux OS, download the 64 Bit JRE.

At the time of writing, 1.6.0 u16 can be downloaded from the following:32 bit JRE, and64 bit JRE. I wanted to install the x64 version, and so downloaded jre-6u16-linux-x64.bin to my Desktop. I also wanted to install it in its own directory in /opt, and so created a directory for it to sit in:

cd /opt
sudo mkdir java

I was also experimenting with the 32 and 64 bit versions, so made two extra directories within java:

cd java
sudo mkdir 32 64

I then moved the relevant file(s) to the respective directories, and made them executable:

32 bit:

sudo mv ~/Desktop/jre-6u16-linux-i586.bin /opt/java/32
sudo chmod 755 /opt/java/32/jre-6u16-linux-i586.bin

64 bit:

sudo mv ~/Desktop/jre-6u16-linux-x64.bin /opt/java/64
sudo chmod 755 /opt/java/64/jre-6u16-linux-x64.bin

The final part of the installation simply involves executing the binary file:

32 bit:

cd /opt/java/32
sudo ./jre-6u16-linux-i586.bin

64 bit:

cd /opt/java/64
sudo ./jre-6u16-linux-x64.bin

Regardless of architecture, this should create a sub directory called jre1.6.0_16.

Setting JRE 1.6.0 u16 as Default

The process simply involves telling the system that there is an alternative Java binary available, and to use this binary to execute an “java” commands:

32 bit:

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/32/jre1.6.0_16/bin/java" 1
sudo update-alternatives --set java /opt/java/32/jre1.6.0_16/bin/java

64 bit:

sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.6.0_16/bin/java" 1
sudo update-alternatives --set java /opt/java/64/jre1.6.0_16/bin/java

Follwing the second command, there should be output to the terminal something along the lines of:

Using '/opt/java/32/jre1.6.0_16/bin/java' to provide 'java'.

or,

Using '/opt/java/64/jre1.6.0_16/bin/java' to provide 'java'.

depending on the architecture installed.

To double check everything is as it should be, in a Terminal run:

java -version

This should output something along the lines of:

java version "1.6.0_xx"
Java(TM) SE Runtime Environment (build 1.6.0_xx)
Java HotSpot(TM) 64-Bit Server VM (build xxxx, mixed mode)

That’s it. Now every time “java” is run, either explicitly from the Terminal, or via a Java executable (such as theEclipse IDE), the newly installed /opt/java/64/jre1.6.0_16/bin/java binary will be used as opposed to the binary installed by default. Simple, eh?

Installing the Browser Plugin

Note:For the 64 bit plugin, it is strongly recommended that you use the version of Firefox available for installation via your distribution’s repositories.

As with most Firefox plugins, they can be installed in ~/.mozilla/plugins – if it doesn’t exist, it can be created:

mkdir ~/.mozilla/plugins

It may also be necessary to uninstall any previous Java installations, such as IcedTea etc.:

sudo apt-get remove icedtea-gcjwebplugin

Note:if you’re upgrading from a previous JRE install, remove the old plugin first:

32 Bit:

rm ~/.mozilla/plugins/libjavaplugin_oji.so

64 Bit:

rm ~/.mozilla/plugins/libnpjp2.so

The Plugin can now beinstalledby either copying the file:

32 Bit:

cp /opt/java/32/jre1.6.0_16/plugin/i386/ns7/libjavaplugin_oji.so ~/.mozilla/plugins/

64 Bit:

cp /opt/java/64/jre1.6.0_16/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

or by creating a symbolic link to the file (this is the best option)

32 Bit:

ln -s /opt/java/32/jre1.6.0_16/plugin/i386/ns7/libjavaplugin_oji.so ~/.mozilla/plugins/

64 Bit:

ln -s /opt/java/64/jre1.6.0_16/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

Once installed, restart Firefox. There are two methods to see if the Plugin is installed – navigate toabout:plugins

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值