How to change the Java version used by Jira Server and Data Center

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.

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


(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 later.

All versions of Jira Service Management 3 and later.

Solution

  1. Install in the Operational System or download the version of Java required by JIRA (see Supported Platforms);
  2. Keep the path of the Java home folder noted, to be used later (step 4); 
  3. Stop JIRA;
  4. 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)

  1. Stop the JIRA service;
  2. 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.

  3. Replace tomcat8.exe with tomcat8w, and RS with ES, and it will provide you with a command like the following:


    1. For Jira 8:

      "C:\Program Files\Atlassian\JIRA\bin\tomcat8w.exe" //ES//JIRA070313174758
    2. For Jira 9:

      "C:\Program Files\Atlassian\JIRA\bin\tomcat9w.exe" //ES//JIRA070313174758
  4. Run the above command on a Command Prompt as an Administrator.
  5. 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
  6. Start the JIRA service;

Linux/Unix

For Linux/Unix based operational system, using manual start:

  • 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/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


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 Aug 5, 2024

Was this helpful?

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