Set up the environment for Java protocols

This topic describes how to set up your Java environment for compilation and replay when working with Java protocols.

About the Java environment

In order to work effectively with any of the Java protocols, you should install a supported JDK on the VuGen machine. See the JDK/JRE support matrix for supported versions.

Running a script involves compilation and replay, so a full JDK is required (a JRE alone is insufficient).

By default, the VuGen uses internal logic to detect the JDK for code generation. You can configure VuGen to use a custom JRE installation. For details, see Set up the Java environment, below.

Once the environment is set up, you can enhance or modify your Java script with standard Java code using JDK libraries or custom classes. VuGen utilizes the standard Java compiler, javac.exe, to compile the script.

After the script is successfully compiled, you can incorporate it into a LoadRunner Professional scenario or Business Process Monitor configuration.

Note: For Java protocols, make sure that your script name or path does not include non-ASCII characters.

Set up the Java environment

Install the JDK and configure runtime settings for the Java protocol, as described in the following steps.

To set up the Java environment:

  1. Install the JDK. For information about supported versions, see the JDK/JRE support matrix.
  2. If you want to use a custom JRE for all code generation, select Tools > Options > Scripting > Java > Custom JRE path, and define the path to the custom JRE folder.

    Note: This sets the custom JRE to be used for code generation and other actions for all VuGen protocols—not just Java protocols.

  3. In your Java protocol script, specify the JDK to use during replay. In Runtime Settings > Java Environment > Java VM:

    • Leave Use internal logic to locate JDK (default) selected to instruct VuGen to locate the JDK. When more then one JDK is installed on the machine, VuGen selects the first one found. The search order is as follows:

      1. Windows registry
      2. JAVA_HOME environment variable
      3. Path environment variable
    • Alternatively, select Use the specified JDK and enter the path to the JDK installation.
  4. You can define additional Java parameters for script replay in Runtime Settings > Java Environment > Java VM > Additional VM parameters.
  5. Set the classpath to the Java classes in Runtime Settings > Java Environment > Classpath. These files are then used as a reference, but are not contained in the script's folder.

Note: If additional files are required during replay, add them as follows: In the Solution Explorer pane, right click the Extra Files node and select Add Files to Script. The files are copied to the script's folder.

Back to top

See also: