Tired of the browser pop-up window asking you to update Java ?
Yes, and we should do it specially because of the usual security concerns.
I’ve done this with Ubuntu 13.04 and 12.04 LTS.
Go to the Java download page and get your “Linux” or “Linux x64” version.
I got the x64 one.
Let’s unpack it. I already have /opt/java/64
. You may have a different place.
$ cd /opt/java/64/
$ sudo tar zxvf ~biafra/Downloads/jre-7u25-linux-x64.tar.gz
Now update Ubuntu configuration with the new Java options
$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/64/jre1.7.0_25/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/java/64/jre1.7.0_25/bin/javaws" 1
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/opt/java/64/jre1.7.0_25/lib/amd64/libnpjp2.so" 1
Let’s force Ubuntu to use the new update
$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).
Selection Path Priority Status
------------------------------------------------------------
* 0 /opt/java/64/jre1.7.0_21/bin/java 2000 auto mode
1 /opt/java/64/jre1.7.0_21/bin/java 2000 manual mode
2 /opt/java/64/jre1.7.0_25/bin/java 1 manual mode
Press enter to keep the current choice[*], or type selection number: 2
update-alternatives: using /opt/java/64/jre1.7.0_25/bin/java to provide /usr/bin/java (java) in manual mode
Done!
Warning! You may think that everything is fine now but there’s a bug in the new update. If you try to open a page with a Java application you may be redirected to java.com!
I used this workaround:
$ rm ~/.java/deployment/config.cache
Go to the page which need Java and it will work again as expected.
Update 2013.10.18: Depending on your browser you may have to update your default java plugin with
$ sudo update-alternatives --config mozilla-javaplugin.so
or
$ sudo update-alternatives --config firefox-javaplugin.so
Hello — I was able to use the “sudo update-alternatives” command successfully! Thank you for sharing that piece of legerdemain. –ceyockey