i have a little problem with starting a JavaScript (-file) from within a Java Application. I know the Application is startable through a simple Script if i put it into a sample.js. The actual call is as follows:
new ActiveXObject("MyApp.Application");
As said, the start via double click on the script file is no problem, but if i try it through the javax.script package:
// create a script engine manager
ScriptEngineManager factory = new ScriptEngineManager();
// create a JavaScript engine
ScriptEngine engine = factory.getEngineByName("JavaScript");
// evaluate JavaScript code from String
engine.eval("new ActiveXObject(\"MyApp.Application\");");
if get the following exception:
Exception in thread "main" javax.script.ScriptException: sun.org.mozilla.javascript.internal.EcmaError: ReferenceError: "ActiveXObject" is not defined. (<Unknown source>#1) in <Unknown source> at line number 1
at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:110)
at com.sun.script.javascript.RhinoScriptEngine.eval(RhinoScriptEngine.java:124)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)
at com.ime.actia.testing.ScriptTest.main(ScriptTest.java:13)
Microsoft Windows Script is installed in the actual version. I know, ActiveX is IE specific, but i don't wanna start the App in/through the IE anyway. Has anybody an idea, how to start the program?
Thanks everyone! ^^
EDIT: Thanks for answers by now! Since I'm not able to get an ActiveXObject from within a JVM, is there another way to start an external application through JScript? I don't care, if it's an ActiveXObject.