How to change the Java version used by Jira

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the server and data center platforms.

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, 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,  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


(warning)  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 8.

All versions of Jira Service Management 3 and 4.


Solution

  1. Install/download the version of Java required by JIRA (see Supported Platforms);
  2. Stop JIRA;
  3. 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"

If the JAVA installed is JDK:

SET JAVA_HOME="\path\to\new\jdk"
  • Set PATH  to include the <Java>\bin folder;
SET PATH="\path\to\new\jdk or jre\bin;%PATH%" 
  • Restart JIRA;

Windows (running Jira as a Service)

  1. Stop the JIRA service;
  2. Run the below command on a Command Prompt as an Administrator, inside the bin folder of JIRA's Installation Directory;

    tomcat8w.exe //ES//JIRA050815072407 

    This command is dependent on the version of Tomcat your instance is using. Check the executable present in <JIRA Install Directory>/bin/

    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.

  3. On the Java tab, choose the location of the jvm.dll file from the JDK/JRE installation directory you want to use;
  4. Start the JIRA service;

Linux/Unix

  • Go to the location where you installed JIRA, then to the bin folder;
  • 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"

If the JAVA installed is JDK:

JAVA_HOME="/path/to/new/jdk"
       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 or jre/bin:$PATH"
  • Restart JIRA

DescriptionDepending on the applications used on your environment, you may not be able to update the Java Runtime Environment to a version compatible with JIRA in a system-wide manner, as this could break older applications relying on older versions of Java.
ProductJira
PlatformServer
Last modified on Feb 3, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.