Set Up the Java Environment

In order to successfully work with any Java protocol, you must install a supported JDK on the VuGen machine.

To set up the Java environment:

  1. Install JDK or JRE depending on your needs.

    JDK

    Replay

    Compile

    JRE

    Code generation

    Record

    For information about supported versions, see LoadRunner System Requirements.

    Note:  

    • JRE alone is insufficient for running a script, since running a script involves compilation and replay.

    • To compile and replay the Java Vuser scripts, you must have a complete JDK installation.

    • It is preferable not to have more than one JDK or JRE installation on a machine. If possible, uninstall all unnecessary versions.

  2. In your Java protocol script configure the runtime settings:

    1. In Java Environment > Java VM, specify the JDK:

      You can instruct VuGen to use internal logic to locate the JDK (default) to locate the SDK, or you can specify which SDK to use.

      Using internal logic (Java 8 and later), when more than one JDK is installed on the machine, VuGen attempts to locate the JDK in the environment variables and selects the first one defined there.

      The first of the following to succeed is used:

      • Uses the LR_JAVA_HOME environment variable. You create this variable if you want to use it to select the JDK.

      • Uses the same JDK used for recording.

      • Searches for a java.exe using the default Windows application search algorithm.

    2. Java Record Replay and Java Vuser scripts: To replay with a 64-bit JDK, select Miscellaneous > Replay script with 64-bit.

    3. All extra files such as jars, classes, and so on, used by the Java Vuser must be accessible by the script by doing one of the following:

      • Add the files to the script's Extra Files folder: 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.
      • In the script's runtime settings, in Java Enviroment > Classpath, set the classpath to the Java classes. These files are then used as a reference, but are not contained in the script's folder.

When 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. Once the script is successfully compiled you can incorporate it into a LoadRunner scenario or Business Process Monitor configuration.

Back to top