How to setup the Java JDK for use with Ranorex Webtestit


#1

Note: since the support of JDK version 9 and 10 has come to its end, and those versions are not supported for building Selenium, we advise you to install and use the JDK 11+ versions. Otherwise, you might end up with an error when trying to execute your tests. You can find more information about this here. Ranorex Webtestit will also work with JDK version 8

Note: since the Oracle version of JDK version 8 and 11 is now subject to new licensing terms, in this article we recommend, and show, how to set up OpenJDK instead.

  1. Download and Install OpenJDK
    On Linux you can also install OpenJDK via terminal apt install openjdk-11-jdk
  2. Restart Ranorex Webtestit

You should now be set! Ranorex Webtestit automatically detects your JDK installation and sets the required JAVA_HOME variable path internally. If you have multiple JDK´s installed, Ranorex Webtestit will use your latest JDK version.

If for some reason, your JDK installation was not found and you get a warning message regarding the variable during project creation, you can set the variable manually by following the instructions below:

Setting JAVA_HOME on Windows

After you’ve installed Java on Windows, you must set the JAVA_HOME environment variable to point to the Java installation directory.

The easiest way is to check the Set JAVA_HOME variable option in the installation process of openJDK 11

java11

To set the JAVA_HOME variable:

  1. Locate your Java installation directory (It will be something like C:\Program Files\Javajdk-11.0.5.10-hotspot)
  2. Do one of the following:
    Windows 7 – Right-click My Computer and select Properties > Advanced
    Windows 8 – Go to Control Panel > System > Advanced System Settings
    Windows 10 – Search for Environment Variables then select Edit the system environment variables
  3. Click the Environment Variables button.
  4. Under System Variables, click New.
  5. In the Variable Name field, enter JAVA_HOME
  6. In the Variable Value field, enter your JDK installation path.
  7. Click OK and Apply Changes as prompted

Screenshots:

Open “System Properties”

Open “Environment Variables”

image

Add System variable “JAVA_HOME”

Restart Ranorex Webtestit

More information on setting JAVA_HOME on Windows.

Set JAVA_HOME on MacOS

  1. Open up Terminal.app (Applications >> Utilities >> Terminal)
  2. Type: emacs .profile
  3. Add these lines to the end of the file:
    JAVA_HOME=/Library/Java/Home
    export JAVA_HOME;
    
  4. Save and exit emacs (ctrl-x, ctrl-s; ctrl-x, ctrl-c)
  5. To verify, open a new Terminal window (cmd-n) and type: $JAVA_HOME/bin/java -version
  6. Restart Ranorex Webtestit

Setting JAVA_HOME on Linux

  1. If you don’t have it, install a nano text editor
  2. Open the terminal and type in:
    sudo nano /etc/environment
  3. Add the following lines:
    JAVA_HOME=<path to the location where you have installed JDK>
    export JAVA_HOME
    
  4. Save the file.
  5. Lastly, reload the system PATH with the following command:
    $ . /etc/environment
  6. Verify by typing echo $JAVA_HOME
  7. Restart Ranorex Webtestit

Unable to import Java Packages
Creating a new project: Installing Node.js link points to wrong setup guide
Step by Step Guide: How to Create Your First Ranorex Webtestit Project
Running Ranorex Webtestit in TFS/VSTS for Continuous Integration
Running Ranorex Webtestit in Jenkins for Continuous Integration
Couldn't update test report
Conflicts between Webtestit and Jenkins on the same server