Java environment variables

This section describes the environment variables that need to be set when you load your Java application with UFT One Java Add-in support. For example, some environment variables need to be set to the path name of the Java Add-in support classes folder.

  1. Perform the following step according to the Java environment you are using:

    • Oracle JDK, OpenJDK, or Zulu OpenJDK

      Specify the _JAVA_OPTIONS environment variable as follows:

      -Xrunjvmhook -Xbootclasspath/a:"<UFT_One_installdir>\bin\java_shared\classes\jasmine.jar

    • IBM Java

      Specify the IBM_JAVA_OPTIONS environment variable as follows:

      -Xbootclasspath/a:"<UFT_One_installdir>\bin\java_shared\classes\jasmine.jar

    • IBM Semeru (OpenJ9)

      Do one of the following:

      • Specify the IBM_JAVA_OPTIONS environment variable as follows:

        -Xshareclasses:enableBCI -Xbootclasspath/a:"<UFT_One_installdir>\bin\java_shared\classes\jasmine.jar

      • Create a new environment variable called OPENJ9_JAVA_OPTIONS and set it to -Xshareclasses:enableBCI.

    The above settings should appear on one line (no newline separators).

    Note: Generally, these variable values are set automatically by UFT One, and you can simply verify their correctness. Alternatively, if you need to modify these variables for any reason, use the instructions below to return them to the values required by UFT One.

  2. Depending on the Java environment you are using, set the JAVA_TOOL_OPTIONS environment variable: 

    Java version

    Variable value

    Oracle Java, Zulu OpenJDK

    -agentlib:jvmhook

    IBM Java versions 1.8 and later / IBM Semeru 8 and later

    -agentlib:jvmhook -Dmic.enforce=ibm

    Tip: If needed, temporarily remove Java support by renaming the _JAVA_OPTIONS / IBM_JAVA_OPTIONS and JAVA_TOOL_OPTIONS environment variables. For example, you must remove Java support if you want to test ActiveX controls that are embedded in SWT- or Eclipse-based applications.

  3. For UFT One to identify Java objects in Java 16 or later (using Oracle JDK, OpenJDK, Zulu OpenJDK, or OpenJ9), you must specify the following options when you run your Java applications:

    • For SWT, Swing, and AWT applications:

      --add-modules=java.desktop --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED

    • JavaFX applications:

      --add-modules=java.desktop,javafx.controls --add-opens java.desktop/sun.awt=ALL-UNNAMED --add-opens java.desktop/sun.awt.image=ALL-UNNAMED --add-opens java.desktop/java.awt=ALL-UNNAMED --add-opens javafx.controls/javafx.scene.control.cell=ALL-UNNAMED

    You can specify these options in one of the following ways: 

    • Include the options in the Java command that you use to run your application.

    • Enter the options in the value of the JDK_JAVA_OPTIONS environment variable. Note that this affects all Java applications that you run on this machine.

  4. Override the values in the Executable file, Command line, and Working directory boxes in the Java Tab (Record and Run Settings Dialog Box) by defining the Java application details using the following variables:

    Option

    Variable Name

    Description

    Executable file

    EXEPATH_ENV

    The executable file or a batch file to open.

    Command line

    CMDLINE_ENV

    The command line to use to open the file.

    Working directory

    WORKDIR_ENV

    The folder to which the specified command line or executable file refers.

Tip: Use short paths in these commands if necessary. For example:

-Xbootclasspath/a:C:\PROGRA~2\
OpenText\UNIFIE~1\bin\JAVA_S~1\classes\jasmine.jar 

In this example, UFT One is installed in the default installation folder (C drive, Program Files) on a Windows computer. PROGRA~2 denotes the Program Files (x86) folder, which is the Program Files folder on 64-bit operating systems.