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.

About these ads

About Josh Aas

Josh Aas is a Gecko platform software engineer with Mozilla Corporation.
This entry was posted in Mozilla. Bookmark the permalink.

33 Responses to Java/Plugin Cleanup for Mozilla 2.0

  1. Mook says:

    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. Does this mean we will finally get stable Java plugin code? That’s great news!

  3. Michael Kaply says:

    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?

  4. Johnny Stenback says:

    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.

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

  6. Toby White says:

    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.

  7. Toby White says:

    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?

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

  9. Brett says:

    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 http://simile.mit.edu/java-firefox-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,
    Brett

  10. Bryan says:

    In looking at the code at http://simile.mit.edu/java-firefox-extension/ , it looks like it uses LiveConnect in order to implement an XPCOM component. For example, it has code that does this:

    var jarURL = new java.net.URL(jarURLStrings[i]);

    so, I think that any change to how “new java….” works may affect this code.

  11. Noel says:

    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!

  12. George says:

    plopbox.net uses liveconnect

  13. netshade says:

    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.

  14. resmy says:

    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

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

  16. Mike says:

    We’re using LiveConnect, too, to remote-control applets using JavaScript and to call back JavaScript from applets.

  17. LiveConnect must be optional on installation, but not eliminate forever.

  18. memals says:

    looks like we need and FAQ, lots of people here are asking the same questions.

  19. dave says:

    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 http://bugzilla.mozilla.org/show_bug.cgi?id=5369 for details.
    Total weirdness: No JSJavaVM wrapper ever created for JavaVM

  20. Glavcho says:

    Losing the ability to call JS from a Java applet will be a complete disaster for us.

  21. Bill says:

    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 http://bugzilla.mozilla.org/show_bug.cgi?id=5369 for details.

  22. Andy says:

    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.

  23. resmy says:

    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.

  24. dwaltz says:

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

  25. If FireFox loses support for LiveConnect, what replaces it?

    I still need my applets to call JavaScript functions, and I still need my JavaScript to call applet methods.

    Works OK now in IE6, IE7, FF1.x, and FF2.x

    Steve Whitlatch
    http://swhitlat.com/XML_Publisher

  26. ra says:

    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

  27. James Stansell says:

    This page seems to be related: https://jdk6.dev.java.net/plugin2/liveconnect/

  28. Tristan says:

    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.

  29. Chris says:

    See the somewhat relevant findings for a possible fix:
    Digithead’s Lab Notebook: Java in Firefox extension hosed again
    http://digitheadslabnotebook.blogspot.com/2008/11/java-in-firefox-extension-hosed-again.html

    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:

    http://www.nabble.com/Java-Firefox-Extension-in-Firefox-3–td15768884.html

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

    Hope this helps,

    Chris

  30. Enrique says:

    A better strategy would be to keep both and prompt liveconnect users to upgrade.

  31. Hi,
    I want to use Java Code in my extension through Java script. Is it Possible. I Have watched the code at http://simile.mit.edu/wiki/Java_Firefox_Extension but not getting any thing what they had done. Can anyone explain the code a bit so that I can get some thing .

    Thanks

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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