Wednesday, March 23, 2016

Setting up Oracle Java JRE 8 on Ubuntu

(from the Java - But Not Coffee department)

Hi everyone,

(This is a quick post - these instructions are necessarily terse and mainly serve as a reminder to myself. If you do try this - you do so at your own risk - I can't provide any help if you mess anything up.)

I needed to set up Oracle Java JRE 8 on my Ubuntu 12.04 LTS 64-bit system.

For previous versions of Oracle Java, I followed the steps in "6. Installation from RPM package" on the web page here:
http://how-to.linuxcareer.com/oracle-java-jdk-7-on-ubuntu-linux-installation

These instructions worked fine for previous versions of Java but broke with JRE 8.

When I analyzed the failure, I saw it was breaking with the alternatives command.  Ubuntu uses update-alternatives instead of alternatives.

So - I decided to try something bold.  I created a symbolic link to alternatives from update-alternatives:

cd /usr/sbin
sudo ln -s update-alternatives alternatives

Then, I followed the steps in "6. Installation from RPM package".  The package installed properly.  Just for reference, here's the commands I used for the JRE 8u77 I installed today:

sudo alien --scripts jre-8u77-linux-x64.rpm
sudo dpkg -i jre1.8.0-77_1.8.077-1_amd64.deb

That left connecting up the Firefox Java plugin.  There's many ways to do that, but I like using alternatives.. er... I mean update-alternatives:

sudo update-alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/default/lib/amd64/libnpjp2.so 20

Obviously - these are for a 64 bit system.  These won't work as written for a 32 bit system or a mixed 64/32 bit system.

Good luck!

Cheers,
Paul 


No comments: