74

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.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • since you do not have a previous installation of java only one choice is shown. – M.Tarun Oct 06 '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 06 '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 07 '13 at 10:56
  • The Java browser plugin is totally different to the Java VM. – Braiam Mar 15 '14 at 17:55
  • @Braiam If you look at the other question, it addresses the browser plugin. Anything here useful to merge in though? – Seth Mar 20 '14 at 04:14
  • 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. – hineroptera Jul 25 '15 at 19:19
  • @hinerm Oracle's Java version is known for not getting along with icedtea plugin. – Braiam Jul 25 '15 at 19:32
  • The only way I got it to work is with https://ftp.mozilla.org/pub/firefox/releases/51.0b9/ <- the last version of firefox to support the old plugin. – Konrad Gajewski Sep 22 '18 at 01:11

6 Answers6

75

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.

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • 1
    :+1 it's right, and need execute: apt-get install default-jre – enrique-carbonell 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. – enrique-carbonell 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
22

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

M.Tarun
  • 5,001
  • 6
  • 33
  • 64
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

e-1
  • 163
  • 1
  • 4
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
luis_js
  • 223
  • 2
  • 4
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.

michael
  • 127