Set Up for the Java Plugin Node
Java Runtime Environment
A Java Runtime Environment (JRE), version 1.5 or later, must be installed on the computer that executes a data job with a Java Plugin node.
Your Java code must be compiled using a Java Development Kit (JDK) of the same version or earlier than the JRE version you plan to use to run your job. For example, compiling your code using JDK 1.6 or later and running the code in the Java Plugin node using JRE 1.5 will generate an error, because the class file format will be incorrect.
The Java Plug-In node requires the Microsoft Redistributable to Run JRE7 on SAS Data Management Studio and SAS Data Management Server. SAS Data Management Studio 2.9 requires Java 8. See Java Requirement.
Java Classpath
A Java classpath specifies the location of your compiled Java code, as well as any code that it depends upon. The CLASSPATH is constructed and searched as follows: <BASE/LIBRARY_PATH>/dfx-java-proxy.jar
<BASE/LIBRARY_PATH>/dfx-java-wlp.jar
<BASE/LIBRARY_PATH>/java_support/
<BASE/LIBRARY_PATH>/dfx-proxy-javaplugin.jar
Node "CLASSPATH" property
Global "JAVA/CLASSPATH" property
If a directory is specified, the directory and any jars found nested in the directory are included in the CLASSPATH. For example, if your Java code is located on a Windows machine in a JAR file called c:\mycode1.jar and your code uses a third-party library located at c:\lib\library.jar, then a JAVA/CLASSPATH option would contain the following:
JAVA/CLASSPATH=c:\mycode1.jar;c:\lib\library.jar
Note: Notice the use of a semicolon (;) to separate entries on the class path, which is the Java convention for Windows platforms only. On UNIX variants, you must separate the path components with a colon (:).
There are three main ways to specify Java classpaths for the Java Plugin node:
- In the Path field for the Java Plugin Node. You can specify a Java classpath in the Path field in the properties window for a Java Plugin node.
- In an app.cfg file. You can set a JAVA/CLASSPATH option in the app.cfg file for Data Management Studio, Data Management Server, or both, depending on which of these applications is used to execute the data job with a Java Plugin node. The JAVA/CLASSPATH option value is added to the end of the CLASSPATH used by various plugin nodes. If a directory is included in the option value, the directory, and any jars found nested in the directory, are included in the CLASSPATH.
- By default. The default Java classpath includes only the example Java Programs that are installed with Data Management Studio and Data Management Server. For more information, see Example Java Programs for the Java Plugin Node.
If a classpath is specified in the Path field, then that classpath is searched before any classpath that is specified in an app.cfg file for Data Management Studio or Data Management Server. If no classpath is specified in the Path field, then any classpath that is specified in an app.cfg file will be the active classpath for the node. If no classpath is specified in either of these two locations, then the default Java classpath is the active classpath for the node.
If the JAVA/CLASSPATH setting is incomplete, SAS Data Management Studio and SAS Data Management Server will report an error because the code could not be loaded. Check to make sure your code and any dependencies are accessible and specified in the class path setting.
Optional Settings
In addition to the JAVA/CLASSPATH setting, there are two other app.cfg settings that affect the operation of the Java Plugin node. They are not required for normal use, but they are available for use by developers for debugging purposes. The settings are JAVA/DEBUG and JAVA/DEBUGPORT.
JAVA/DEBUG should be set to Yes or No. When set to Yes, debugging in the JVM used by SAS Data Management Studio or SAS Data Management Server is enabled. By default this setting is set to No.
JAVA/DEBUGPORT should be set to the port number where you want the JVM to listen for debugger connect requests. This can be any free port on the machine. This setting has no effect if JAVA/DEBUG is set to No.
Note: Java debugger cannot connect until SAS Data Management Studio initializes the JVM in process. This happens when a Java Plugin Properties dialog is opened or when a Java Plugin node in the job is executed or previewed. If you have multiple SAS Data Management Studio processes or SAS Data Management Server processes running concurrently on the same machine, only the first to respond to load the JVM secures the debugging port. All subsequent processes will not respond to the Java debugging connection requests.