...
Code Block |
---|
language | js |
---|
title | Example: compatible solution |
---|
|
var file = Packages.java.io.File(files[i]);
file["delete"](); // because delete is reserved in javascript |
Accessing Java Packages
The following is an example that will cause an initialization error message when used in ECMA script.
Code Block |
---|
language | js |
---|
title | Example: Accessing Java Packages |
---|
collapse | true |
---|
|
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.
Code Block |
---|
language | js |
---|
title | Example: Accessing Java Packages |
---|
collapse | true |
---|
|
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.sos.net.SOSMail(myVariable.smtp());
....
} catch(e){
throw "Error initializing myObject: "+e;
}
....
} |
See also
...