Results 1 to 1 of 1
- 02-13-2009, 09:16 AM #1
Member
- Join Date
- Feb 2009
- Posts
- 5
- Rep Power
- 0
Cannot run Java from Firefox Extension using liveconnect?!
Hi, I'm trying to run a very simple java program from a Firefox extension I'm making but I've run into a brickwall and just can't get it to work. I'm a complete beginner in java and don't know much javascript so I've copied and pasted code from around the net to get where I am now. I'm sure I'm just making some stupid error at some step.
In order to work out what I'm misunderstanding/doing wrong I'd be really grateful if someone could show me how to get it to work using a very basic example:
Say I have a .java file taken from the sun pages:
So I stick it into a jar using:Java Code:/** * The HelloWorldApp class implements an application that * simply displays "Hello World!" to the standard output. */ class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); //Display the string. } }
jar.exe cvfe HelloWorldApp.jar HelloWorldApp.class HelloWorldApp.class
I then place it directly on my C: drive.
In the javascript of my firefox extension I have code copied and pasted from developer.mozilla.org/en/Java_in_Firefox_Extensions:
This seems to start java but then only gives me the error:Java Code:var urlClasz = java.lang.Class.forName("java.net.URL"); var urlArray = java.lang.reflect.Array.newInstance(urlClasz,1); urlArray[0] = new java.net.URL('file:///C:/HelloWorldApp.jar'); var cl = java.net.URLClassLoader.newInstance(urlArray); var aClass = java.lang.Class.forName("HelloWorldApp", true, cl); var aStaticMethod = aClass.getMethod("HelloWorldApp", []); var greeting = aStaticMethod.invoke(null, []);
"Error: uncaught exception: Error calling method on NPObject! [plugin exception: java.lang.ClassNotFoundException: HelloWorldApp]."
I would be infinitely grateful if someone could show me the code I would use in this situation to run the HelloWorldApp. If I could get it working in this basic situation I'm sure I could work it out from there.
Thank you very, very much!!Last edited by mzatanoskas; 02-13-2009 at 09:20 AM.
Similar Threads
-
Track Java web application logs in Firefox using LogDigger
By martinw in forum Java SoftwareReplies: 0Last Post: 11-24-2008, 06:48 PM -
Issue jsp with FireFox
By dimuthunsj in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 10-10-2008, 11:08 AM -
Java Cryptography Extension Unlimited Strength Jurisdiction Policy Files.
By Nicholas Jordan in forum Advanced JavaReplies: 0Last Post: 08-26-2008, 09:00 PM -
Getting domainname/user in Firefox
By Ganesh Prasad in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 02-14-2008, 01:13 PM -
IE and Firefox
By Ed in forum Advanced JavaReplies: 1Last Post: 06-15-2007, 04:16 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks