In the last week or so the Java plugin on my laptop completely broke. I’m not sure what exactly has happened but it just stopped working. At first Chrome started complaining that my Java is out of date but I ignored it. Not because I felt like it, but because the latest and greatest release from sun has not yet hit 10.4 repositories. I was confident that it would get there eventually, so I just let it linger. Then it broke.
Why am I running 10.4 and not the latest release? Because it’s an LTS. It is still fully supported, it still gets security patches and it lets me ignore the upgrade threadmill. It’s not that I don’t like new shiny features – I just happen to have a finicky Nvidia video card that relies on proprietary drivers which may or may not need some time investment to get working properly. Same goes for my sound card. Almost every time I do a system upgrade I am left with 600×800 resolution and no sound until I figure out what broke this time. So at some point in the past I wisely decided that that laptop is going to be an LTS only machine.
Broken Java installation should not be a huge problem, but it just so happens that I often use that machine to maintain the local Barracuda SSLVPN which uses a two factor authentication scheme . The login page actually uses an applet to search for a key file in your file system. Yes, and applet. I know – it’s an abomination unto all that it’s holy. But the SSLVPN does have some really useful functionality. If I must use Java in order to get it, then so be it. You can imagine that having a broken Java was a bit of an inconvenience.
In about:plugins I had it listed as libnpjp2.so with the correct path:
There was no usual description, and no details associated with that entry. It looked strange and broken. I tried to uninstall and reinstal sun’s Java package via apt, but that just was not working. So I finally broke down and decided to manually install Java 18.104.22.168.
To keep things simple I decided to dump it into /opt because that’s where I keep things like that. I have Chrome living in /opt/google/chrome/ so it made sense to put my non-deb Java in /opt/java/. First, let’s create that folder:
sudo mkdir /opt/java
Next, we download the self extracting .bin file from java.com download page, move it to our new directory and extract it:
sudo cp jre22.214.171.124.bin /opt/java/ cd /opt/java/ sudo chmod +x jre126.96.36.199.bin sudo ./jre188.8.131.52.bin sudo rm jre184.108.40.206.bin
To ensure this new version is globally registered on the system we open the Java console:
- Click on the Java Tab
- Click on View
- Click on Find
- Click Next
- Navigate to /opt/java/jre220.127.116.11
- Click Next
- Click Finish
- Uncheck all previous versions
- Click Ok
- Click Apply
The list in #8 should look something like this:
Next we need to link the plugin in the Chrome directory so that it can find it.
You should have a /opt/google/chrome/plugins folder here. For some reason, I didn’t. Not sure why, and how that happened since other plugins like flash were working fine. I ended up having to create it:
sudo mkdir plugins cd plugins sudo ln -s /opt/java/jre1.6.0_30/lib/i386/libnpjp2.so .
After this, Java started working again like a champ. If it does not work for you, you might need to change your chrome shortcut to run with –enable-plugins parameter. I already added that one a while ago, when I started getting the outdated plugin messages.
I’m putting this here mostly for my own reference, and for posterity. Perhaps this will help someone whose Java gets similarly broken. While these sort of posts are probably not all that interesting to regulars, they do sometimes bring in some Google traffic, and direct new potential readers to my blog.
I promise to post something more fun on Friday.