Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

running a java program from javascript

  • 28-02-2006 05: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