Set a new default JRE for test projects
Katalon Studio uses the default embedded Java Runtime Environment (JRE) v8 to run a Katalon Studio instance and compile test projects. You can learn more about JRE v8 in the Oracle document here: JRE v8.
From Katalon version 7.9.0 onwards, you can set your desired JRE package as the default one to compile and run test projects. You can also override the default configuration in console mode by using the environment variable.
- This change applies to the JRE used to run your test projects, not the JRE used to run Katalon Studio.
- Set a new default JRE for a Katalon Studio instance.
- Apply the new JRE to a test project.
- Run tests with another JRE in the command line.
Set a new default JRE for a Katalon Studio instance
- Katalon Studio version 7.9.0 onwards.
- The desired JRE version (from v8 to v14) installed on your machine.
First, you need to set your desired JRE as the default JRE in Katalon Preferences. In this example, we set JRE 11 as the default one. Do as follows:
-
Open Preferences > Java > Installed JREs.
Tip:Type "jre" in the search bar.
-
Click on button Add....
-
In the displayed Add JRE dialog, select Standard VM.
-
Browse to the
Home
folder of the JRE you wish to add and give it a name. Here, we name it JRE 11. Click Finish.
-
In the Installed JREs interface, check the newly added JRE to set it the default one. Click Apply and close.
Use the newly added JRE in a test project
To run a test project with the new JRE:
-
Download
jaxb-api-2.3.1.jar
library. You can download JAXB API 2.3.1 from the Maven Repository website here: JAXB API 2.3.1. -
Add the
jaxb-api-2.3.1.jar
library to your test project. To do so, you can follow the instructions in this document: Add an external library to a project.Note:- The JRE version used to run test projects and JRE compiler compliance level should be compatible. For instance, Java 8 test projects are compatible with the default JRE compiler level 1.8. To alter JRE compiler compliance level, go to Preferences > Java > Compiler.
- In case you want to check which Java version the test project is developed with, add the following script to a test case, then run it and see the log.
println System.getProperty('java.version')
Run tests with another JRE in the command line
- Katalon Runtime Engine version 7.9.0 onwards.
- The desired JRE version (from v8 to v14) installed on your machine.
- An active Katalon Runtime Engine license. To learn more about activating licenses, you can refer to this document here: Katalon Runtime Engine.
KATALON_JAVA_HOME= <JRE_location>
environment variable and use it before Katalon commands. Below is a sample command on macOS and Linux for your reference:export KATALON_JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home.
./katalonc ...