Setting Java Development Kit (JDK) Environment Variables

In Provar, Apache ANT can run a Provar test suite via the command line or a Continuous Integration (CI) server such as Jenkins. Before generating a build file, install Java Development Kit (JDK) and configure the environment variables. You can follow the steps below to complete these actions.

How To Install Java Development Kit


Step 1: Download a compatible version of Java JDK. We recommend Amazon Corretto 11

Compatible versions include:

  • 1.8.0.162, 1.8.0.172, 1.8.0.201, 1.8.0.211, 1.8.0.221

Note: You can reference the Java version mismatch error support article to learn how to resolve related error messages. 

Step 2: Complete the installation by following the prompts. Be sure to take note of the installation directory information, e.g., C:\Program Files\Java\jdk1.8.0_221. You will need to add this information to the environment variable settings later.

Set the JAVA_HOME Environment Variable on a Windows Machine


Step 1: Open the System Control panel. Then select the Advanced tab.

Image showing a view of the Advanced tab within System Properties

Above: View the Advanced tab within System Properties

Step 2: Click the Environment Variables button. The following dialog box will appear.

Click the Environment Variables button. The following dialog box will appear when installing Java Development Kit

Above: View of the Environment Variables dialog box. 

Step 3: Click the New button below System variables

Step 4: Within the Variable name field, enter JAVA_HOME. Within the Variable value field, enter the directory where Java JDK was extracted previously, e.g., C:\Program Files\Java\jdk1.8.0_221. 

Step 5: Then click the OK button.

Within the Variable name field, enter JAVA_HOME and enter the directory where Java JDK was extracted

Above: View of New System Variable dialog box. 

Step 6: Go to the Path variable in the System variables section and click the Edit button.

Go to the Path variable within the System variables section and click on the Edit button

Step 7: Click the New button and type %JAVA_HOME%\bin in the row at the bottom of the list.

Click the New button and type %JAVA_HOME%\bin in the row at the bottom of the list

Step 8: Click OK and restart your system.

Step 9: To verify that you have installed the correct Java version, open the command prompt and type the following command:

Java -version

how to verify that you have installed the correct Java version

Set the JAVA_HOME Environment Variable on a Mac


Step 1: Navigate to your user home directory. The fastest way to do this is to use Shift + Command + H or open Finder, select Go in the menubar, and then click Home.

Select home to set the JAVA_HOME Environment Variable on a Mac

Step 2: Find the .bash_profile. The .bash_profile may be hidden. If so, use command+shift+period to make hidden files visible. 

Note: The command above does include a period/dot after the second plus sign. 

Step 3: If you still do not see the .bash_profile, use the following command within the terminal to display the file: 

touch .bash_profile.

Step 4: Right-click on the .bash_profile file and select Open With > TextEdit.

how to edit .bash_profile file with TextEdit when installing Java Development Kit in Mac

Step 5: Add the following command: 

export JAVA_HOME=$(/usr/libexec/java_home)

Step 6: Export JAVA_HOME to PATH with the following command: 

export PATH=$PATH::$JAVA_HOME/bin

Step 7: Now restart your machine or use the following command:

source ~/.bash_profile

Step 8: Type the following command: 

java -version. 

Note: It should now display the JDK version information. The subversion may be different from the screenshot below.

sample of successfully installing Java Development Kit version information

Other Related Support Articles for Reference


Apache Ant users: How to fix Java version mismatch error

Setting Apache Ant environment variables

Running Provar on Linux

Docker integration

Review Provar on G2
Documentation library

Other available resources

Looking for something different?

We use cookies to better understand how our website is used so we can tailor content for you. For more information about the different cookies we use please take a look at our Privacy Policy.

Scroll to Top