Using Java Classes
You can access Java classes in JavaScript. The following are examples for using JAVA classes:
var myJAVAString = new java.lang.String(“JAVA_1.4_String”);
var tokens = new java.util.StringTokenizer(myJAVAString, “_”);
var myList = new java.util.LinkedList(); // creates an empty list
// Add JAVA strings to the list
myList.add( new java.lang.String(“List Element A”) );
myList.add( new java.lang.String(“List Element B”) );
myList.add( new java.lang.String(“List Element C”) );
For a full list of available classes, refer to the appropriate Sun Java docs.
Note the following:
• You can use server-side event triggers to run custom Java code from a script.
• Custom individual class files go in the installdir/data/java/classes directory on the server.
• Custom JAR files go in the installdir/data/java/jars directory on the server.
• To use custom classes in JavaScript:
var myApp = new Packages.<myPackage>.<myAppClass()>;
|
Custom Java code runs in the Windchill RV&S server JVM and code that runs intensive activities can degrade server performance!
|