Home page Ubuntu C++ Hardware HTML i javascript Java Software SQL flag_united_kingdom flag_poland

Adding a Java plug-ins into your browser to be able to run applets.

Added: 2011-09-03

When the Firefox browser and / or Opera in Ubuntu can not display Java applet that resides on a web page and automatically install of plugin does not work, you must manually add this package.

Before making any changes in Ubuntu, make sure that the missing library libnpjp2.so not exists somewhere in the system.

find / -name libnpjp2.so 2>/dev/null

If you can not find the path to the library, must you download package from page Java Downloads for All Operating Systems. After downloading not existing libraries, install them in system. In Ubuntu OS, after downloading package, unzip it, the best way to do it is run command in terminal.

After extracting the files, you need to find a library libnpjp2.so and add a link to this file in the folder browser plug-ins:

  • Opera - /usr/lib/opera/plugins
  • Firefox - /usr/lib/mozilla/plugins

To create link to file of library Java, can you use command:

sudo ln -s [pathToJavaPlugin] [pathToFolderPluginBrowser]

The operations above may seem daunting, so you should use a script to automate these operations ;)

This script consists of three files. Operation initialization file is instal_plugin_java.bash Example of run scripts in terminal below. The first is the name given initialization file, second name is the name of the Java library package downloaded from the Internet:

instal_plugin_java.bash jre-6u27-linux-x64.bin

Print Select
instal_plugin_java.bash
#!/bin/bash

echo "The script unpacks the parcel Java libraries, and adds a link to the Opera browser plug-ins folder and/or Firefox."
echo "Chcac kontynuowac wcisnij dowolny klawisz..."
read

function returnPathToScript() {
	temp=$(cd ${0%/*} && echo $PWD/${0##*/})
	pathToScript=`dirname "$temp"`;

	echo $pathToScript;
}


if [ -f $1 ]
then
	echo "Plik jest: \""$1"\"";
	"./"$1
#find / -name libnpjp2.so 2>/dev/null
	find $(returnPathToScript) -name libnpjp2.so 2>/dev/null | awk '{
		system("./addLinkToFirefox.bash "$0);
		system("./addLinkToOpera.bash "$0);
		
	}'
else
	echo "File not exist \""$1"\"";
fi
Print Select
addLintToOpera.bash
#!/bin/bash

#file need instal_plugin_java.bash

if [ -d /usr/lib/opera/plugins ]
then
	echo "Dodawanie linku do pluginow Opery";
	sudo ln -s $1 /usr/lib/opera/plugins
else
	echo "#########################";
	echo "ou do not have Opera or the path is different.";
	echo "Script search path: "/usr/lib/opera/plugins;
	echo "#########################";
fi 
Print Select
addLintToFirefox.bash
#!/bin/bash

#file need instal_plugin_java.bash

if [ -d /usr/lib/mozilla/plugins ]
then
	echo "Dodawanie linku do pluginow Firefox";
	sudo ln -s $1 /usr/lib/mozilla/plugins
else
	echo "#########################";
	echo "ou do not have Firefox or the path is different.";
	echo "Script search path: "/usr/lib/mozilla/plugins;
	echo "#########################";
fi 

If you find unintelligible text, write to me corrected words, please - lis.la(at)wp.pl