Plugins and Java

Posted on 1998-12-04
Last Modified: 2013-11-23
I have some questions about plugi-ns:

1. Is it possble to code plug-ins with Java?

2. Do I have to make different versions of my plug-in for IE and NS browsers?

3. Can you give me some pointers to resources about plug-in programming.
  • 5
  • 4
LVL 16

Expert Comment

ID: 1228752
what is plugin ?

Author Comment

by:Christoffer Swanström
ID: 1228753
Plug-ins are programs that enable web browsers to handle data types that it cannot natively handle. Examples are Shockwave, RealPlayer and Acrobat.

Author Comment

by:Christoffer Swanström
ID: 1228754
Edited text of question
LVL 16

Expert Comment

ID: 1228755
>> Plug-ins are programs that enable web browsers to handle data types that it cannot natively handle.

Plug-ins are web-browser extensions (probably written in their native platform language)
JAva applets are small programs written in platform independent (and browser independend) code. So java applets does not extend browser behaviour, but the HTML code itself. If your clients have Java enabled browser they can use all kinds of applets. Some applets may render PDF files, other applets can act as news group readers or even participate in real-time  multiplayer games ...

applets are much more than simple browser extensions

>> 2. Do I have to make different versions of my APPLET for IE and NS browsers?
no you write only one version of the applet and every Java enabled browser will handle it.

3. Can you give me some pointers to resources about APPLET programming.

Author Comment

by:Christoffer Swanström
ID: 1228756
Yes, the difference between Java applets, applications and browser plug-ins are all crystal clear to me.

What I'm interested in is _plug-ins_, mind you. I'm just trying to find out if there is anything that stops me from writing the plug-in in Java instead of C/C++. Also I'm interested in the differences between plug-ins for Navigator and Explorer, ie. do I have to put in a considerable amount of extra work to get the plug-in work in both browsers. I would like to somehow assess the amount of work needed for a plug-in before actually starting the project.

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline


Expert Comment

ID: 1228757
Here is the Procedure for using Java Plugin (I have used a Jar file in this example and will be signing the Jar file using javakey ) . The plugin will work both for Netscape and IE .

you can find more information at the javasoft site

1. Create a JAR file to archive your class files: use the jar tool from the JDK.
All your applet's files have to be located in a single directory, or in subdirectories of that directory.
From within the applet's main directory, use the command:
> jar cvf myjarfile.jar *.class images
to create a new JAR archive (myjarfile.jar) with all the class files and the subdirectory images.

JavaSoft Resources: jar - The Java archive tool


2. Modify the applet tag that refers to your applet to preload the JAR file.
Add the ARCHIVE field in your HTML file as follows:
<APPLET CODE=applet_name ARCHIVE=archive_name> ... </APPLET>

JavaSoft Resources: jar Guide


3. Sign the JAR file: use the javakey tool from the JDK.
The javakey tool handles the creation and management of identities, public and private keys, and certificates.
To be able to sign your JAR file, you first need to get a certificate: you can either buy one ( or make one using javakey.

JavaSoft Resources: Using javakey

3.1 Create an identity in the identity database:
> javakey -cs "myName" true

3.2 Generate DSA key pair (public and private) for the identity:
> javakey -gk "myName" DSA 512 my_pub my_priv

3.3 Create a certificate directive file using your preferred editor and save it as a text file (myNameCertDir.txt).
This file contains critical arguments for creating the certificate: = myName
issuer.cert = 1 = myName = myName = My Comany = Company = USA = 1 Jan 1998 = 1 Jan 2000
serial.number = 1001
out.file = myNamecert.cer (file where to output the certificate - optional)

3.4 Generate a certificate:
> javakey -gc myNameCertDir.txt

3.5 Create a signing directive file using your preferred editor and save it as a text file(myNameSignDir.txt):
signer = myName
cert = 1
chain = 0 (always set to 0 in JDK 1.1)
signature.file = myNameSig

3.6 Sign the JAR archive:
> javakey -gs  myNameSignDir.txt myjarfile.jar


4. Install the Java Plug-in 1.1.1 from Sun
Netscape Navigator (Communicator) and Microsoft Internet Explorer 4.0 still do not support the Java Platform 1.1 to full extent like the security features.  To launch a signed applet from your favorite browser, you need to install the Java Plug-in 1.1.1 from JavaSoft.  This Plug-in allows users to specify an alternative JVM which can then be used instead of the browser's in-built virtual machine.

For documentation and free download, check the Plug-in web site:

After installation, make sure that the file NPJava32.DLL is correctly installed in the Plugins directory of Netscape Navigator and Internet Explorer.


5. Convert your HTML file for the Java Plug-in 1.1.1
You need to modify your HTML file in order for the browsers to detect the request for the Plug-in to be executed.
Along with the Java Plug-in 1.1.1, Sun also provides a free tool that will automate the required changes in your HTML file: the HTML Converter.
This tool is free for download from the Plug-in web site:

Example - Applet code before modification:
<applet archive="Counter.jar" code="Counter.class" width="600" height="300">

Example - Applet code after modification (for Internet Explorer and Netscape Navigator):

(<object> tag for Internet Explorer)
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH="600" HEIGHT="300" codebase=",1,1,0">
<param name="CODE" value="Counter.class">
<param name="ARCHIVE" value="Counter.jar">
<param name="type" value="application/x-java-applet;version=1.1">

(<embed> tag for Netscape Navigator)
<embed type="application/x-java-applet;version=1.1"
WIDTH="600" HEIGHT="300"


<APPLET CODE = "Counter.class" ARCHIVE = "Counter.jar" WIDTH = "600" HEIGHT = "300" >



LVL 16

Expert Comment

ID: 1228758
... and maybe you are interested in writing plug-ins for Windows, Macintosh, Solaris etc.
plug-ins for a particular browser are programs written i native platform language that support some kind of (native) plug-in protocol
trying to write in a Java program that will support some native plug-in protocol is not an easy task (if possible). Java is designed for writing cross-platform applications (and applets) - not extensions to native once ....
if you really want to write plug-ins - not applets (which is the better choice) you'd better post this question on the "browsers" forum.

hope this helps

LVL 16

Expert Comment

ID: 1228759
and if you really want to write plug-ins in Java instead of C/C++ you sure need to use Microsoft J++ (so that you can access Win platform)

(note: Microsoft J++ is not Java ...)

Author Comment

by:Christoffer Swanström
ID: 1228760
Sorry, but this really isn't the information I was looking for. Once again, what I'm going to do is write a plug-in and I just want to know if I can do it with Java or do I have to use C/C++. Netscape at least has an SDK for C/C++. Also, I'd like to know if there are any major differences in implementing a plug-in for Microsoft Internet Explorer and Netscape Navigator.

Please read the question and understand what I'm looking for before answering.
LVL 16

Accepted Solution

heyhey_ earned 80 total points
ID: 1228761
    1. Is it possble to code plug-ins with Java?
plug-ins for Windows version of NN  / IE ? No - that is not possible (or maybe possible, but MUCH TOO HARD - that is almost impossible)

    2. Do I have to make different versions of my plug-in for IE and NS browsers?
if you can use only ActiveX (which is NOT plug-in) - no. Generally you need different plug-in versions for both browsers.

    3. Can you give me some pointers to resources about plug-in programming.
please ask this question at the "Browser Forum"

hope this helps

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now