How to change the Java version used by Jira Server and Data Center
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
As an admin, you may want to change the Java version being used by JIRA. This may be due to a Java version no longer being compatible or because you'd like to use a different version than the one defined in the OS.
In case you installed JIRA through its installer, these instructions may not be needed since JIRA will always include a compatible version and use that instead of the one defined on your operating system. However, when JIRA is installed through an archive file, JRE does not come bundled.
Changing to JDK 64bit on a JIRA which uses 32Bit installer is not possible.
Since Jira 8.0 these flags are set under JIRA_INSTALL/bin/set-gc-params.sh
The following Java flags are no longer supported in Java 9 and upwards.
You must remove these flags when running JIRA with Java 11 and above, otherwise JIRA will fail to start.
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+PrintGCCause
-XX:+PrintTenuringDistribution -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=20M -Xloggc:<PATH_TO_GC_LOGS>
For JAVA 11 and above, make sure to have the parameter below to keep logging GC activity.
-Xlog:gc*:file=$LOGBASEABS/logs/atlassian-jira-gc-%t.log:tags,time,uptime,level:filecount=5,filesize=20M
If these flags are manually set in the JIRA_INSTALL/bin/
setenv(.sh/.bat)
, it is recommended to remove them!
Environment
All versions of Jira Core or Software 7 and later.
All versions of Jira Service Management 3 and later.
Solution
- Install in the Operational System or download the version of Java required by JIRA (see Supported Platforms);
- Keep the path of the Java home folder noted, to be used later (step 4);
- Stop JIRA;
Set the path where you installed Java as the
JAVA_HOME
(JDK) or JRE_HOME (JRE) variables for JIRA (see instructions below);
Note: If JRE_HOME is not defined, Jira will define its value using the JAVA_HOME value.
JDK suggested over JRE
If possible, consider installing the JDK instead of the JRE.
JDK provides valuable tools for troubleshooting purposes like jstack
(for easily generating Thread dumps) and jmap
(for easily generating Heap dumps).
Windows (manual start)
- Go to the path where you installed Jira, then open the
bin
folder; Edit the
setenv.bat
file, including the below just under the@echo off
line;
If the JAVA installed is JRE:
SET JRE_HOME="\path\to\new\jre\home"
If the JAVA installed is JDK:
SET JAVA_HOME="\path\to\new\jdk\home"
- Set PATH to include the <Java>\bin folder;
SET PATH="\path\to\new\jdk\bin or jre\bin;%PATH%"
- Restart JIRA;
Windows (Jira as a Service)
- Stop the JIRA service;
Right click the service, go to properties and find the value of the "Path To Executable" parameter. It looks something like
"C:\Program Files\Atlassian\JIRA\bin\tomcat8.exe" //RS//JIRA070313174758
This command is dependent on the version of Tomcat your instance is using. Check the executable present in <JIRA Install Directory>/bin/
Alternatively, you can get the service name by going to your Windows services and copying the service name for the "Atlassian JIRA" service. For example, 'JIRA050815072407' in this case.
Replace tomcat8.exe with tomcat8w, and RS with ES, and it will provide you with a command like the following:
For Jira 8:
"C:\Program Files\Atlassian\JIRA\bin\tomcat8w.exe" //ES//JIRA070313174758
For Jira 9:
"C:\Program Files\Atlassian\JIRA\bin\tomcat9w.exe" //ES//JIRA070313174758
- Run the above command on a Command Prompt as an Administrator.
- On the Java tab, choose the location of the
jvm.dll
file from the JDK/JRE installation directory you want to use;
For example, the location of the new file could look like this:C:\Program Files\Atlassian\JIRA\
jdk-17.0.9+9\bin\server\jvm.dll
- Start the JIRA service;
Linux/Unix
For Linux/Unix based operational system, using manual start:
- Go to <JIRA_INSTALL>/bin;
Edit the
setenv.sh
file and add the lines at top of the file:
If the JAVA installed is JRE:
JRE_HOME="/path/to/new/jre/home"
If the JAVA installed is JDK:
JAVA_HOME="/path/to/new/jdk/home"
- For instance: JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home"
Set PATH to include the
<JAVA>/bin
folder
PATH="/path/to/new/jdk/bin or jre/bin:$PATH"
- Restart JIRA