简体   繁体   中英

Calling Java application (.jar) using JavaScript in a Firefox extension

I am writing a Java application as a Firefox extension. I need the JavaScript to call my external java application and pass one parameter to it.

But... how to do this? Any idea?

in short and with out isFileExists or try catch:

var file = Components.classes["@mozilla.org/file/local;1"].
                            createInstance(Components.interfaces.nsILocalFile);

                file.initWithPath(path);
var oProcess = Components.classes["@mozilla.org/process/util;1"].
                                        createInstance(Components.interfaces.nsIProcess);

                    oProcess.init(file);
var args = null;
 var argsLen = 0;
if (params) {
args = [params];
argsLen = 1;
 }


oProcess.run(false, args, argsLen);

hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM