Set Up the Java Environment
In order to successfully work with any Java protocol, you must install a supported JDK on the VuGen machine.
Setting up the Java environment
Install JDK/JRE and configure runtime settings for the Java protocol, as described in the following steps.
To set up the Java environment:
Install JDK or JRE depending on your needs.
For information about supported versions, seeJDK support matrix.
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.
In your Java protocol script configure the runtime settings:
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.
Java Record Replay and Java Vuser scripts: To replay with a 64-bit JDK, select Miscellaneous > Replay script with 64-bit.
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 Environment > 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.
The following JDK versions are required for script replay with Java protocols.
|Version 6||Version 7||Version 8||Version 9||Version 10|
|32-bit (for Java over HTTP, Java Record Replay & Java Vuser protocols)||Oracle JDK||Oracle JDK||Oracle JDK||Common OpenJDK Distributions||Common OpenJDK Distributions|
|64-bit (for Java Record Replay & Java Vuser protocols)||n/a||n/a||Oracle JDK||Oracle JDK/Common OpenJDK Distributions||Oracle JDK/Common OpenJDK Distributions|
For more information about supported versions, see the System Requirements.