Re: calling java from a javascript XPCOM component

From: Stefano Mazzocchi <stefanom_at_mit.edu>
Date: Mon, 17 Oct 2005 18:25:48 -0400

Andrew Harrison wrote:
> Hi,
>
> This is really a general question. Piggybank seems to be able to create
> Java object from within a Javascript component. Could anyone explain how
> this was achieved? I've got LiveConnect working in the JavaScript on an
> html page, but when I try the same thing from within a component it
> doesn't work. So somehow I need to tell Firefox to use the LiveConnect
> when it's loading the component, but I can't work out how.
>
> Any help appreciated.
>
> cheers,
>
> Andrew
>
> PS - I'm on a Mac - but like I say, I've got the LiveConnect working in
> an html page.

Andrew,

the xpconnect subsystem (the one that wraps XPCOM) is *not* conneced to
LiveConnect, so you have to pass the "java" object from an actual web
page to "enable" it.

Look into nsPiggyBank.js and nsClassLoader.js, those are the files that
control the whole system. nsClassLoader especially contains a lot of the
black magic of classloading and policy settings that you need to enable
the JVM integration.

We should write a "how to write xpcom components in java" howto, but
boy, so much work to do :-/

-- 
Stefano Mazzocchi
Research Scientist                 Digital Libraries Research Group
Massachusetts Institute of Technology            location: E25-131C
77 Massachusetts Ave                   telephone: +1 (617) 253-1096
Cambridge, MA  02139-4307              email: stefanom at mit . edu
-------------------------------------------------------------------
Received on Mon Oct 17 2005 - 22:20:30 EDT

This archive was generated by hypermail 2.3.0 : Thu Aug 09 2012 - 16:39:18 EDT