Results 1 to 1 of 1
  1. #1
    mzatanoskas is offline Member
    Join Date
    Feb 2009
    Rep Power

    Default 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:
    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.
    So I stick it into a jar using:

    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

    Java Code:
    var urlClasz = java.lang.Class.forName("");
    var urlArray = java.lang.reflect.Array.newInstance(urlClasz,1);
    urlArray[0] = new'file:///C:/HelloWorldApp.jar');
    var cl =;
    var aClass = java.lang.Class.forName("HelloWorldApp", true, cl);
    var aStaticMethod = aClass.getMethod("HelloWorldApp", []);
    var greeting = aStaticMethod.invoke(null, []);
    This seems to start java but then only gives me the error:

    "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

  1. Replies: 0
    Last Post: 11-24-2008, 06:48 PM
  2. Issue jsp with FireFox
    By dimuthunsj in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 10-10-2008, 11:08 AM
  3. Replies: 0
    Last Post: 08-26-2008, 09:00 PM
  4. Getting domainname/user in Firefox
    By Ganesh Prasad in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-14-2008, 01:13 PM
  5. IE and Firefox
    By Ed in forum Advanced Java
    Replies: 1
    Last Post: 06-15-2007, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts