"Proper" way to Access Java from javascript
sam keen <[email protected]> Sun, 2 Dec 2007 12:55:41 -0800 (PST)
| Newsgroups | gmane.comp.mozilla.devel.java |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <65b36062-c745-47ce-ba85-1ff877a930ba__35028.516702778$1196629255$gmane$org@i12g2000prf.googlegroups.com> |
I'm working on a Firefox extension that needs to access some native OS for information. As an example, lets say I would like to capture the Output of uname -a and display it in XUL window. I have accomplished this by adapting with MIT's SIMILE example (http:// simile.mit.edu/wiki/Java_Firefox_Extension). The small java lib I have written gathers information and returns it as a JSON formated string. The javascript in the FF extension calls this java method and uses the string returned. >From what I understand (i may be mistaken), the technique used in SIMILE is somewhat of a hack and I am not sure I want to release an extension based on this to the masses. I've read up on javaxpcom, liveconnect, and a bit of xulrunner and at this point I am confused as to the best way (forward compatible and blessed by the Mozilla developers) to perform this somewhat simple task. So for the functionality I described above, which do you think is the best method. And depending on you answers, the specific problems I and having are javaxpcom: cannot find any examples for js -> java communication liveconnect: - is this true "LiveConnect may be removed from Mozilla 2.0 according to this post by Josh." - for statements like var red = new Packages.HelloWorld(); where do you place your jar file so it can be found? thanks in advance, any pointers/help is very appreciated