How Java Extensions Work

To use a Java Extension, it must be initiated from a TrafficScript rule using the java.run() function. The java.run() function initiates a process called the Java Extension Runner. The Java Extension Runner maintains instances of all the Extensions uploaded in memory, and passes that information from TrafficScript to the instances when the java.run() function is initiated.

Setting Up the Traffic Manager

To use Java code in TrafficScript, first configure how Java operates. Click System > Global Settings > Java Extension Runner to set up Java support in the Traffic Manager.

To use Java extensions on the Traffic Manager, first enable Java support by setting java!enabled to “Yes”. Java support is disabled by default in newly-configured Traffic Manager instances.

To specify a Java runtime executable file, set the java!command field to the name of the executable file (and the path if it is not on the systems default search path), along with any command line options that Java should use. By default, the java!command is set to java -server.

Under Global Settings, you will find these Java-related fields:

java!lib (optional): This setting identifies the system location where the third-party Java jar files are located, such as /usr/share/java.

All Java classes in this folder will be searched when the Java Extension runner starts, and whenever this setting is modified.

java!classpath (optional): This setting can be used to specify a list of jar files that should be searched when the Java Extension runner starts.

This setting can be used to identify individual jar files that are not located in java!lib.

To check the setup, click Diagnose, and verify that the Java Extensions section does not report any errors. If error free, the Java Extensions are now ready for use.