...
Code Block | ||||
---|---|---|---|---|
| ||||
var file = Packages.java.io.File(files[i]); file["delete"](); // because delete is reserved in javascript |
...
Getting Java
...
Objects
The following is an example that will cause an initialization error message when used in ECMA script.
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
import sos.net.SOSMail; |
However, the following construction shows how new Packages.sos.net.SOSMail(myVariable.smtp());
can be used within a function call as an alternative.ECMA script construction can be used to instantiate Java objects using new Packages.myPacket.myClass();
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
function myFunction(){ var params; var debugParameter = function(paramName) { try{ spooler_log.debug1(".. mail parameter ["+paramName+"]: "+params.value(paramName)); } catch (e){} //No error handling } try{ var myVariable = spooler_log.mail(); this.myObject = new Packages.sosmyPacket.net.SOSMail(myVariable.smtp())myClass(); .... } catch(e){ throw "Error initializing myObject: "+e; } .... } |
Note that import myPacket.myClass();
will cause an initialization error message when used in ECMA script.
For example, the following error would be typical for import sos.net.SOSMail;
Code Block | ||||
---|---|---|---|---|
| ||||
[ERROR] COM-80020009 Ausnahmefehler aufgetreten. [step] [] [Z-JAVA-105 Java exception java.lang.RuntimeException: javax.script.ScriptException: sun.org.mozilla.javascript.internal.JavaScriptException: Error initializing sosMail: TypeError: Cannot find function set_queue_dir in object sos.net.SOSMail@2403f3b1. (<Unknown source>#39) in <Unknown source> at line number 39 - caused by - javax.script.ScriptException: sun.org.mozilla.javascript.internal.JavaScriptException: Error initializing sosMail: TypeError: Cannot find function set_queue_dir in object sos...], method=call |
For more information, see:
...