Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

running a java program from javascript

  • 28-02-2006 4:28pm
    #1
    Closed Accounts Posts: 201 ✭✭


    The title explains the problem anyone have any ideas on how I might be able to execute a command like "java -classpath . hello" from inside a javascript file or so that I could start up a java program which interacts with the javascript automatically when the javascript is executed.

    Alternatively maybe i could execute a bat file with the command in it to execute the java program.

    I realise there are some problem in javascript with regard to starting external programs anyone know a way around this.

    Cheers


Comments

  • Closed Accounts Posts: 54 ✭✭Valehru


    Not possible! If this feature was even remotely possible you could crush, rape, maim and pillage a users computer!

    Just FYI....aim for a different approach!


  • Closed Accounts Posts: 86 ✭✭toString


    look into creating an applet or Java web start


  • Closed Accounts Posts: 54 ✭✭Valehru


    Running an applet is a good idea but it is often bulkey and pointless to do so. The company I work for despises applets with a passion.

    What exactly are you using the javascript for - Conditional Logic? Could you not do the same in a JSP page? would make things much easier I suppose.

    You really must give us details about what you are trying to achieve should you wish us to give you some advice.


  • Registered Users, Registered Users 2 Posts: 1,275 ✭✭✭bpmurray


    Well, it's sorta possible using JSObject. Search Sun's site for how to do it.


  • Closed Accounts Posts: 201 ✭✭bazcaz


    Its a thunderbird email client extension implemented mainly in javascript which talks to a piece of java by http.

    I want to be able to start up the java from the thunderbird interface rather than having to start up the java independently each time I want to use the extension

    I know there is a way of doing it ,its definitely not impossible


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    Try MozillaZine, afaik it is doable within the extension framework. Just can't recall how offhand.


  • Closed Accounts Posts: 201 ✭✭bazcaz


    ya i got it sorted thanks


  • Closed Accounts Posts: 86 ✭✭toString


    bazcaz wrote:
    ya i got it sorted thanks
    how, with MozillaZine?


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    bazcaz wrote:
    ya i got it sorted thanks

    Yea please post solution here so that another who has the same issue can find it here.


  • Closed Accounts Posts: 201 ✭✭bazcaz


    var file = Components.classes["@mozilla.org/file/local;1"]
             .createInstance(Components.interfaces.nsILocalFile);
       file.initWithPath(PathToBatchFile);
       process = Components.classes["@mozilla.org/process/util;1"]
                            .createInstance(Components.interfaces.nsIProcess);
       process.init(file);
       var blocking=false;
       var argv=[];
       process.run(blocking,argv,argv.length);
    

    The batch file holds the java command to run the program I want.


  • Advertisement
Advertisement