Plugins and Java

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.
Christoffer SwanströmPartnerAsked:
Who is Participating?
heyhey_Connect With a Mentor Commented:
    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
what is plugin ?
Christoffer SwanströmPartnerAuthor Commented:
Plug-ins are programs that enable web browsers to handle data types that it cannot natively handle. Examples are Shockwave, RealPlayer and Acrobat.
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Christoffer SwanströmPartnerAuthor Commented:
Edited text of question
>> 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.
Christoffer SwanströmPartnerAuthor Commented:
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.

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" >



... 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

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 ...)
Christoffer SwanströmPartnerAuthor Commented:
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.