Tip: Getting Java on Google Chrome for Linux
I’ve recently jumped on the Linux bandwagon and installed Linux Mint as the primary OS on my work machine. Cutting the long story short, I installed Chrome and discovered that it didn’t have the Java plugin pre-installed. Bummer.
So naturally, I went to download the latest Java runtime for Linux (jre-6u18-linux-x64.bin) here and installed it at /opt/java. For you Linux newbies, I’ll go easy on you as I too was a Linux n00b not too long ago 🙂
Make a new directory for your JRE install and move the downloaded jre-6u18-linux-x64.bin to the new directory
sudo mkdir /opt/java
sudo mv jre-6u17-linux-i586.bin /opt/java
Add the permissions to allow the bin file to be executed, then execute it.
sudo chmod +x jre-6u17-linux-i586.bin
Then follow the instructions and get the installation done and over with.
And you’d wish that the installation would recognize any installed browser, in this case Chrome, and automatically install the Java plugins to the browser right? Well, fat chance. LOL!
After scouring the Internet, I found out that apparently, there’s two things that you’d need to do.
Firstly, you need to ensure the enabled JRE is the one you’ve downloaded for your user. To do this, just use the Java Control Panel to set it.
The easiest method is to just access it from your GUI.
Or you can always start it from the terminal.
Once the Java Control Panel, click on the Java Tab, then click on View… to add in the location of the JRE.
Click Find and search for the /opt/java/jre1.6.0_18.
Click Next and Finish. Now the make sure that only the new JRE is enabled by un-checking any other JRE that’s already enabled.
Click OK and Apply the changes. With this, the first step is now done. Now your user would be using the JRE you’ve just installed. Next, you’d need to copy over the Java plugin and enable it to work on Chrome. Just follow the following steps and you’ll be able to run Java components on the web!
Create a plugins directory in Google Chrome’s directory if it does not already exist.
sudo mkdir /opt/google/chrome/plugins
Then, create a symbolic link of the libnpjp2.so library in the plugins directory
ln -s /opt/java/jre1.6.0_18/lib/amd64/libnpjp2.so .
Note: If you’ve installed the 32-bit JRE, then the lib is likely to be in the /opt/java/jre1.6.0_18/lib/i386/ directory.
Lastly, run Chrome with the following command options to enable the plugins.
google-chrome –enable-plugins %U
That’s it. You now can run Java components on Chorome! In order to validate your Java installation, just point Chrome here and the Java JRE version would be verified.