Chrome and Java plugin on Ubuntu 10.4

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.

I know, I know. Fuck Java. Fuck flash, fuck Java, fuck all them plugins with a broomstick! Let’s do everything in HTML5 and JavaScript. Honestly, I’m all for it. To me Java is mostly a back-end technology good for doing enterprisy stuff. It is not really that welcome on the client side of things because most of the time the native solution is going to be much more responsive, while Java windowing toolkits tend to be treated as second class citizens. You can do some cool client-side things with Java – like Minecraft for example. But for the most part, it is best on the back end.

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:

/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/i386/libnpjp2.so

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 1.6.0.30.

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 jre1.6.0.30.bin /opt/java/
cd /opt/java/
sudo chmod +x jre1.6.0.30.bin
sudo ./jre1.6.0.30.bin
sudo rm jre1.6.0.30.bin

To ensure this new version is globally registered on the system we open the Java console:

ControlPanel
  1. Click on the Java Tab
  2. Click on View
  3. Click on Find
  4. Click Next
  5. Navigate to /opt/java/jre1.6.0.30
  6. Click Next
  7. Click Finish
  8. Uncheck all previous versions
  9. Click Ok
  10. Click Apply

The list in #8 should look something like this:

Registered versions of Java

Registered versions of Java

Next we need to link the plugin in the Chrome directory so that it can find it.

cd /opt/google/chrome

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.

This entry was posted in sysadmin notes and tagged . Bookmark the permalink.



7 Responses to Chrome and Java plugin on Ubuntu 10.4

  1. Hexren GERMANY Mozilla Firefox Ubuntu Linux says:

    Hey,

    maybe you were hit by this:
    https://lists.ubuntu.com/archives/ubuntu-security-announce/2011-Decemb er/001528.html

    Licence foo removal of sun from ubuntu repositories.

    Reply  |  Quote
  2. Mart SINGAPORE Mozilla Firefox Windows Terminalist says:

    All my years using Java on Ubuntu, I never knew there was a “ControlPanel” command! How that got past my googling, we may never know..

    Thanks for that!

    Reply  |  Quote
  3. Luke Maciak UNITED STATES Google Chrome Linux Terminalist says:

    @ Hexren:

    That might be quite likely. Ugh… Licensing! Why can’t we all just get along and use GPL or something. :P

    Reply  |  Quote
  4. I go through a similar process at work on occasion. In order for a computer to gain full network access, it either has to be fully managed by our IT department (Windows systems), or it has log in through a Java applet (Linux, Mac, etc.). There’s an example of “enterprisey stuff” for you. However, it’s a chicken-or-egg problem, since I need* internet access to install OpenJDK from the repositories.

    So, like your process above, I grab the self-extracting zip from Sun, put it on a thumb drive, dump it in /tmp, softlink libnpjp2.so to plugins/, log in, apt-get install openjdk-*, then remove the softlink. Since it’s in /tmp, it will get fully blown away on the next reboot. The only difference is that I’m using Firefox instead of Chrome.

    On a side note, as you may know, I’m still using Java applets for my little projects. You’re right that Java applets are clunky and HTML5 would be better. However, all my Java projects are originally standalone .jars. Turning them into Java applets is nearly trivial — the same .jar is both an applet and an executable .jar — so I still use applets in order to make my stuff more accessible.

    * Yeah, I could manually grab the .debs and all the dependency .debs, but that’s a huge waste of time.

    Reply  |  Quote
  5. Mitlik UNITED STATES Internet Explorer Windows says:

    @ Luke Maciak:

    You should really be pushing: WTFPL ^_^

    Reply  |  Quote
  6. Yea when you start moving stuff around, and having the symlink it back to your created dir… I could see that to be annoying.
    I would leave it in its default dir and symlink to your opt, rather than the other way around.
    Unless that’s what you did, but either way.

    I can understand the opt option though, as I believe chrome installs in the home dir?
    I could see that to be annoying to some people. I’m unsure of where java installs, I thought it was all in usr/.

    Reply  |  Quote
  7. Luke Maciak UNITED STATES Google Chrome Linux Terminalist says:

    @ Chris Wellons:

    Wow, that’s kinda silly. Nice of them to screw things up for non-windows users. :P

    @ Mitlik:

    Ah, yes – the ultimate license.

    @ Andrew Zimmerman:

    The standalone package from java.com does not actually install anywhere. It is a self extracting archive that just unpacks to the current directory. I figured that putting it in /opt was smarter than leaving it in my home directory. The .deb packages dump files all over the file system but that’s to be expected.

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *