how do I use java applets with Firefox

Can someone please show me how I can use/install a java applet I downloaded to work with my browser (firefox). The applet is BNCApplet.java that I got from this link:

I have installed openjdk using:

sudo apt-get install openjdk-8-jdk

And tried to compile by:

javac BNCApplet.java

which gave me loads of error messages that mean nothing to me. Here it is:

javac BNCApplet1.java
BNCApplet1.java:51: error: class BigNumCalc is public, should be
declared in a file named BigNumCalc.java public class BigNumCalc ^ Note: BNCApplet1.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note:
BNCApplet1.java uses unchecked or unsafe operations. Note: Recompile
with -Xlint:unchecked for details. 1 error

I am sure this java program is bug-free and should work flawlessly. In any case should I be compiling this at all before I can use it as a plugin? And how do I use it as a plugin.

Update: I have also installed icedtea as suggested by Byte Commander:

sudo apt-get install icedtea-8-plugin

and checked it in firefox preferences and it is there and active.

When I File/Open the BNCApplet.java in firefox it simply offers to save the file!

I badly need a step-by-step insrtructions to install this applet. Thanks

4

1 Answer

A .java file is a Java source code file, which is a plain text document. It is not executable.

To run it, you would have to install a JDK (Java Development Kit) like the openjdk-8-jdk package, if you don't have one already:

sudo apt-get install openjdk-8-jdk

After that, you can use the Java compiler javac to compile the source code BNCApplet.java file to a byte code .class file:

javac BNCApplet.java

After that, you can run the compiled BNCApplet.class file using the java command, but without the .class suffix:

java BNCApplet

Further reads about how to compile and run .java files on Ubuntu:


I'm not 100% sure, but this way Applets should run in a separate Applet Viewer window. To be able to run Java Applets in your browser if you use an OpenJDK Java implementation, you need the additional IcedTea package that provides a browser plug-in for Firefox-like (NPAPI) browsers. Oracle Java already includes this plug-in.

To install the plug-in for OpenJDK 8, run:

sudo apt-get install icedtea-8-plugin
2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like