Use Java Classes without Shutter File
These days I read an interesting old
post about the com.vmware.scripting.javascript.allow-native-object property. Ilian Iliev wrotes: "This property is used to filter Java classes that are visible to scripts." The following logic shows that when this property is set to true, the ClassShutter has no effect. So I set this property in the Control Center and tested it. As far as I can tell, all classes are accepted when this property is set to true. This is a great thing, because on this way you can save to allow classes exactly, e.g. in test environments. That makes it much easier.
com.vmware.scripting.javascript.allow-native-object
Get Available Packages Example
With the above setting, for example, the available packages can be detected.
var javaPackages = java.lang.Package.getPackages();
javaPackages.forEach( function(javaPackage) {
System.log(
javaPackage.getName() + ";" +
javaPackage.getImplementationTitle() + ";" +
javaPackage.getImplementationVendor() + ";" +
javaPackage.getImplementationVersion() + ";" +
javaPackage.getSpecificationTitle() + ";" +
javaPackage.getSpecificationVendor() + ";" +
javaPackage.getSpecificationVersion() + ";" +
javaPackage.hashCode()
);
});
|