Java/Plugin Cleanup for Mozilla 2.0

After a hugely productive series of exchanges and meetings with engineers from Sun, we are going to be eliminating LiveConnect, OJI, and all of our XPCOM plugin interfaces from Mozilla 2.0. Sun’s Java plugin will be using NPAPI’s NPRuntime support and a very small number of NPAPI/NPRuntime extensions to do everything that they used to do with LiveConnect, OJI, and the XPCOM plugin interface.

This is fantastic news as it means we’ll be dropping a large number of interfaces and many thousands of lines of complex and largely unmaintained code. It also means that Java plugin performance under Mozilla 2.0 should be significantly better.

If you know of any consumers of these APIs other than Sun and the JEP plugin, please let me know. Currently we are unaware of any other consumers, but if others exist we would like to start working on a migration strategy with them immediately.

33 thoughts on “Java/Plugin Cleanup for Mozilla 2.0

  1. Yay!

    Does this cover the XPCOM scripting stuff? I do know though that, on Linux, mplayerplug-in uses that. (I don’t think it uses OJI/LiveConnect though.) I think it might also touch unfrozen stuff – it didn’t like me when I had my own builds, unless I also built the plugin itself. Or maybe I just had mismatched gcc ABI or something…

  2. Can you be more specific with “eliminating LiveConnect”

    There are websites all over the web that use LiveConnect.

    LiveConnect is the ability to call JS from Java and Java from JS.

    Since the NPAPI API supports plugin to JavaScript and vice versa, will the LiveConnect functionality still be in the plugin?

  3. I’m surprised to hear there are websites “all over the web” that use LiveConnect (I can’t say I’ve ever seen one myself, short of testcases for it etc). But yes, LiveConnect functionality will be there through a new set of Java-specific hooks in the plugin API.

  4. Josh, I have two projects that depend on LiveConnect.
    They depend on its Java-to-JavaScript API (JSObject);
    on its data conversion scheme for parameter and return values;
    and on its thread-safety regime. Will these be affected, do you think?

  5. I have a project using the LiveConnect API – using the Java-JS API (JSObject) to allow the plugin to query the DOM of the page in which it is embedded.

    However, it does look to me like the NPAPI supports this too. This will prompt me to try changing over to NPAPI which looks rather more robust – LiveConnect’s always been a bit flaky.

  6. Actually, having said that – I can’t anywhere find the documentation on how to use the NSruntime API from within a Java Applet. Where does it live?

  7. Wow, I remember when LiveConnect was introduced sometime in the ’90s. I wrote quite a few prototypes which used it and tried to sell it to management… they didn’t bite because of the lack of support in IE. Well, this is the end of an era!

  8. Hi,

    I’ve been really itching to get Berkeley DB XML native XML database to work inside of Mozilla (to have a way to get XQuery to work in Mozilla and also to be able to easily import documents from the web into BDBXML), and rather than going with XPIDL (which apparently won’t handle objects that are needed to handle the BDBXML API), upon discovering the existence of LiveConnect, I thought I could just use the Java code (assuming LiveConnect lets you get any privileges you need, such as to query or write to a file/database). I also saw this extension which seems to use both approaches (LiveConnect and XPCOM), so I was encouraged further in the direction of LiveConnect. But if NPAPI is the way to go now, are there any examples out there of how to use Javascript to run Java code through NPAPI, and can one get any privileges desired through this interface? How does the type conversion work, etc., etc.?

    thanks very much,

  9. I have been using LiveConnect in a number of our projects. I hate to see it go and hate to have to rewrite all of them to use another method!

  10. The promise of better performance would be pretty good…it kinda sucks that it appears that this functionality is now gone from the Gecko 1.9 builds, there’s no documentation anywhere on how to regain it using a Sun plugin, and Sun isn’t broadcasting anything about NPAPI compatibility (that I’ve found).

    I think before Mozilla does much to improve the plugin, it’d be awesome if there was more documentation somewhere on what the plan will be.

  11. Is there any option avilable to get the support of liveconnect api in firefox. In our project we have used javascript/java communication.

    Please anyone do reply

  12. I’m using LiveConnect to access and use Java libraries from my Firefox extension (just like Bryan mentioned above). The NPRuntime support mentioned does not seem to be an alternative for this; if this ability is removed, my extension is kaput.

  13. A FAQ would be good. Our services are broken in FF3B3. We call script functions from Java using netscape.javascript.JSObject and now we get:

    MRJ Plugin JEP: JavaScript-to-Java LiveConnect failed — no security manager!
    initialization error: Can’t load class netscape/javascript/JSObject
    MRJ Plugin JEP: JavaScript-to-Java LiveConnect failed — no security manager!
    initialization error: Can’t load class java/lang/Object
    LiveConnect was unable to reflect one or more components of the Java runtime.
    Go to for details.
    Total weirdness: No JSJavaVM wrapper ever created for JavaVM

  14. What they said- an FAQ would help

    Mar 7 14:02:30 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: ### MRJPlugin: getPluginBundle() here. ###
    Mar 7 14:02:33 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: ### MRJPlugin: CFBundleGetBundleWithIdentifier() succeeded. ###
    Mar 7 14:02:33 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: ### MRJPlugin: CFURLGetFSRef() succeeded. ###
    Mar 7 14:02:39 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: MRJ Plugin JEP: JavaScript-to-Java LiveConnect failed — no security manager!
    Mar 7 14:02:57: — last message repeated 6 times —
    Mar 7 14:02:39 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: initialization error: Can’t load class netscape/javascript/JSObject
    Mar 7 14:02:39 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: MRJ Plugin JEP: JavaScript-to-Java LiveConnect failed — no security manager!
    Mar 7 14:02:57: — last message repeated 6 times —
    Mar 7 14:02:39 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: initialization error: Can’t load class java/lang/Object
    Mar 7 14:02:39 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: LiveConnect was unable to reflect one or more components of the Java runtime.
    Mar 7 14:02:39 dhcp108 [0x0-0x1c01c].org.mozilla.firefox[347]: Go to for details.

  15. We have an application that is deployed to 15+ million users worldwide in G2C and B2B environments that depends heavily on the LiveConnect functionality. LiveConnect is actively in use today on many important web sites. It is not an option to expect all existing applications that use LiveConnect to simply rewrite their implementations to use another API.

  16. If live connect support is removed then we need another option for java-javascript communication.
    Due to this issue we are facing problem with our application support in Firefox on Mac. We are stuck with this issue as we don’t have any other option.

  17. does anybody know of any place with working examples for java-js interaction using NPAPI?
    thanks ina dvance

  18. Hi,

    now how can i handle it with NPAPI to communicate javascript in my browser and java in both ways.
    i cant find very much information
    on the Gecko plugin API ref. and don’t were to look else

  19. Does this mean that for end developers there is no change? merely just that the java plugin will communicate with firefox in a different manner? No end user API changes etc?

    Or do I need to rewrite my applet?

    Because as far as I can tell firefox java->js communications are fubared.

  20. See the somewhat relevant findings for a possible fix:
    Digithead’s Lab Notebook: Java in Firefox extension hosed again

    This individual has a marvelous background and appears to know what he is talking about. Unfortunately, I am not experienced with js or java enough to correctly interpret what he is saying… My understanding is we are supposed to supplement the two lines of code (declarations) for the existing line that he has referenced here. I am still having the same issue, however I am convinced there is something I have missed as the discussion here supports his work:–td15768884.html

    Perhaps someone can elaborate as to how to implement this simple fix more thoroughly?

    Hope this helps,


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s