70

I am trying to install Java and plugins for Firefox. I installed both the JDK and JRE.

When I try with the sudo update-alternatives --config java command it shows only one choice available.

Plugins are not usable in Firefox.

  • since you do not have a previous installation of java only one choice is shown. – M.Tarun Oct 6 '13 at 12:00
  • 1
    To me it is not clear what your problem is. Is java functioning properly? Can you compile and run java programmes? – Luís de Sousa Oct 6 '13 at 14:20
  • As far as I understand you have installed jdk, jre and the browser plugins (icedtea). But you can't use the plugins, can you explain further what the problem is? Are you getting an error? Btw, you can uninstall (Remove) and re-install IcedTea at the Software Centre. – Luís de Sousa Oct 7 '13 at 10:56
  • 2
    @Seth but you want OP to read through all of that for something that can be solved in 1 line? The other is an overkill answer, the question is just "how to install Java?" while this is "how to install Java browser plugin for firefox?", those are different questions and can't be merged. – Braiam Mar 20 '14 at 12:08
  • 1
    I agree with @Braiam above. This is a different question because updating the Java version used by firefox is not the same as simply installing java. I personally have oracle Java 6, 7, and 8 JDKs but installing icedtea did nothing for my firefox. I had to follow these instructions with a JRE downloaded from java.com. Then firefox was happy. – hinerm Jul 25 '15 at 19:19
74

If you are using a version after 52 (not ESR), which disabled NPAPI, you are out of luck. If you are using one prior, which you absolutely wouldn't want to, you can install the OpenJDK JRE, which would allow you to execute Java binaries locally using the java binary. This however, isn't enough to execute Java web applets on your browser, which can be accomplished by installing the Icedtea plugin:

sudo apt-get install icedtea-plugin

Then go to about:addons, in the plugin section, check if the plugin is enabled. Mozilla disables insecure plugins by default, that means that Java is disable even after installation due security concerns. You need to activate it before using it.

  • 1
    :+1 it's right, and need execute: apt-get install default-jre – kikicarbonell Jul 18 '14 at 13:48
  • 1
    @kikicarbonell unless Ubuntu is something different, that package should be installed along with icedtea-plugin. – Braiam Jul 18 '14 at 13:54
  • not for my case @Braiam. I have Ubuntu 14.04 and open-jdk installed...but if only execute your command my Firefox not execute java applet...Later, I try to execute apt-get install default-jre and firefox problems was solved. – kikicarbonell Jul 18 '14 at 14:04
  • 2
    @kikicarbonell firefox disables the java plugin by default. So you have to tell it to activate it. – Braiam Jul 18 '14 at 14:25
23

Installing the IcedTea Java plugin:

To install the IcedTea Java plug-in, open a terminal and type:

sudo apt-get install icedtea-7-plugin

Install the Firefox plug-in - Oracle

In a terminal:

mkdir ~/.mozilla/plugins

Remove the IcedTea plugin, if it has been installed.

sudo apt-get remove icedtea6-plugin

Remove a former version of the Java plugin (may or may not be present)

rm ~/.mozilla/plugins/libnpjp2.so

Now you can install the plugin, by creating a symbolic link (you tell Firefox where the plugin is located). For 32-bit Java, use

ln -s /usr/lib/jvm/jre1.7.0/lib/i386/libnpjp2.so ~/.mozilla/plugins/

For 64-bit Java use

ln -s /usr/lib/jvm/jre1.7.0/lib/amd64/libnpjp2.so ~/.mozilla/plugins/

Confirm that the JRE has been successful by using the official Oracle website.

Source: Java installation

  • 3
    Are you sure you answered the question? The guy is saying he already installed the jdk and the jre. – Luís de Sousa Oct 6 '13 at 14:22
  • Why compile jre from sources, why! – Braiam Oct 6 '13 at 14:23
  • didn't see the question properly:) – M.Tarun Oct 6 '13 at 15:58
  • have a look also at oracle.com/technetwork/java/javase/… for any doubts – Victor R. Oliveira May 11 '14 at 13:01
  • 4
    As of Ubuntu 14.04, Java is no longer supported in the most recent version of Chrome/Chromium. – Andreas Hartmann Jul 15 '14 at 7:48
8

Beginning in Firefox version 52, support for NPAPI plugins (java applets) in Firefox has ended, due to performance and security issues, the way that I manage to run java applets is to install the Extended Support Release (ESR) of firefox.

download here: https://www.mozilla.org/en-US/firefox/organizations/all/

more details here: https://support.mozilla.org/en-US/kb/npapi-plugins

5

If you just downloaded and installed java jdk from oracle, then, let's say you have installed jdk-8u91-linux-x64.tar.gz on

/my/java/directory/

Then you'll have a directory like:

/my/java/directory/jdk1.8.0_91/

All you have to do is go to your ubuntu firefox plugins directory and create a link:

$: cd /usr/lib/firefox-addons/plugins/
$: sudo ln -s /my/java/directory/jdk1.8.0_91/jre/lib/amd64/libnpjp2.so
  • With Firefox 50 on Ubuntu 16.04.1, I found that directory didn't exist. Other plugins like IcedTea created symlinks in /usr/lib/mozilla/plugins. – Dan Dascalescu Jan 23 '17 at 16:05
  • Or symlink in your home /home/<your home>/.mozilla/plugins – myset Oct 10 '18 at 13:48
3

This is an old thread, but I stumbled upon it while googling a solution to my problem today. I figured someone else might be in the same situation.

I need in-browser Java for legacy work-related websites, and the oracle java plugin does not cut it. After a long trial-and-error approach, I got IcedTea working consistently in an older version of firefox like this:

  • Download a tar of Firefox, version 51 (newer version don't support the plugin)
  • Install the OpenJDK (7 or 8)
  • Install the icedtea--plugin and the icedtea-plugin
  • Now your openJDK installation will contain a IcedTeaPlugin.so file in the jre/lib folder
  • copy this to the mozilla/firefox plugin folders (I couldn't figure out which one to copy it too, so I just copied it to anything firefox/plugins or mozilla/plugins)
  • start your old firefox version
  • verify the plugin is active (check about:plugins)

One of my colleagues created a script to remove the old firefox, and untar it on every run. That way it never gets updated accidentally. Be sure not to do this with your main firefox application.

I hope this helps you.

1

Its been a battle, especially since I went through this a couple of months ago with 14.04, forgot the solution, upgraded to 16.04.....

It is different I had Iced-tea and Oracle working under firefox in 14.04. I actually prefer Oracle (not generally but my use almost requires it) so I only have that now. I did not attempt any multiple installs or repositories. Symlinks as per most of the instructions out there are no good either.

In the end, in Firefox went to Edit--> Preference-->Applications then scrolled down to the JNLP file extension and picked "Use other..." from the drop down menu. Then found javaws from the relevant directory.

It is only a workaround, and Im not sure if it will suit your needs. Keep in mind most plugins will be deaded by March.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.