Getting Started
Special
SINGLE SIGN-ON
Teams
Users
Escalation Policies
Service
Incident
On-Call Shift
Schedules
Schedule Override
API Token
Logs
Webhook
Slack
Reports
Preference
Profile
Automation
FAQ
Java Installation for Linux and Windows
Installation of Java 17 for CG Automation Runner on Linux, Unix and Windows
The cg-automation-runner.jar is designed to work on any OS that supports Java 17. While it can run on different platforms, we strongly recommend using OpenJDK 17 to ensure compatibility and performance.
Installing Java 17 on Red Hat-based Linux Distributions
Step 1: Install the EPEL Repository
To install Java 17 on Red Hat-based systems (RHEL, CentOS, Rocky Linux, etc.), you first need to ensure that the EPEL (Extra Packages for Enterprise Linux) repository is enabled, as it may provide additional packages.
Command to enable EPEL:
bash sudo dnf install -y epel-release
Step 2: Install Java 17 (OpenJDK)
Once the EPEL repository is set up, use the following command to install Java 17 (OpenJDK) on your system:
Command to install OpenJDK 17:
bash sudo dnf install -y java-17-openjdk
Step 3: Set Java 17 for the CG Automation Runner User (cgautouser)
If your system has multiple versions of Java installed, you should configure Java 17 as the default for the user running the CG Automation Runner JAR (e.g., cgautouser).
- Switch to the cgautouser user:
bash su - cgautouser
- Edit the user's .bash_profile: Add the following lines to ensure that Java 17 is always used for this user:
bash vi /home/cgautouser/.bash_profile
- Insert the following Java 17 environment variables into the .bash_profile file:
bash # Java 17 specific export JAVA_HOME=`alternatives --list | grep java-17 | awk '{print $3}' | tail -n 1` export PATH=$JAVA_HOME/bin:$PATH
- Save and exit the file and then refresh the environment variables:
bash source /home/cgautouser/.bash_profile
This ensures that whenever cgautouser is running the cg-automation-runner.jar, Java 17 will be used, even if other versions of Java are present on the system.
Installing Java 17 on Other Linux/Unix Distributions
For other Linux or Unix-based operating systems, follow the official OS instructions to install OpenJDK 17. You can usually find Java packages via the system's package manager (e.g., apt for Debian/Ubuntu or zypper for SUSE).
Installing Java 17 on Windows Server 2022
Step 1: Download Java 17 from Microsoft
For Windows installations, we recommend using the Microsoft OpenJDK 17. Other Java distributions will work, but this is a recommended option for a stable Java environment.
- Visit the Microsoft OpenJDK download page:
- Download Microsoft OpenJDK 17
- Download the appropriate version for your system (x64 or ARM).
- Run the installer and follow the instructions to install Java 17.
Step 2: Set Java 17 for the CG Automation Runner User
If your Windows system has multiple versions of Java installed, you must ensure that the user running the cg-automation-runner.jar (optionally cgautouser or any other user) always uses Java 17.
Step 2: Set JAVA_HOME and Path Manually
- Open PowerShell as Administrator.
- Set JAVA_HOME and Update PATH:
powershell [Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Microsoft\jdk-17.0.x.x-hotspot", "Machine") [Environment]::SetEnvironmentVariable("Path", "$Env:JAVA_HOME\bin;$Env:Path", "Machine")
- Verify Java version: Close and reopen your terminal, then run:
cmd java -version
Option 2: Use PowerShell Script to Set Java Home for Each Session
If you want to set Java for a specific user session, use the following PowerShell script:
powershell # Set JAVA_HOME $javaPath = "C:\Program Files\Microsoft\jdk-17.0.x.x-hotspot" [System.Environment]::SetEnvironmentVariable("JAVA_HOME", $javaPath, "Process") $env:PATH = "$javaPath\bin;$env:PATH" # Verify Write-Host "JAVA_HOME set to: $javaPath" Write-Host "Updated PATH in the current session: $env:PATH"
Run this script to ensure that Java 17 is used in that session.
Summary
- For Linux/Unix: Use java-17-openjdk and configure it using the .bash_profile for users with multiple Java versions installed.
- For Windows: Download and install Microsoft OpenJDK 17, and set it as the default Java version for users running the cg-automation-runner.jar.
With this setup, the CG Automation Runner will use Java 17, ensuring stability and compatibility across both Windows and Linux environments