Invalid Java location

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Symptoms

Starting Bitbucket Server will get the following error:

1 2 3 4 5 6 7 8 9 10 11 12 13 # bin/start-bitbucket.sh -fg Starting Atlassian Bitbucket Server as current user Detecting JVM PermGen support... PermGen switch is supported. Setting to 256m\n Using BITBUCKET_HOME: /home/bitbucket Using CATALINA_BASE: /opt/atlassian/atlassian-bitbucket-1.3.1 Using CATALINA_HOME: /opt/atlassian/atlassian-bitbucket-1.3.1 Using CATALINA_TMPDIR: /opt/atlassian/atlassian-bitbucket-1.3.1/temp Using JRE_HOME: /usr/bin/java Using CLASSPATH: /opt/atlassian/atlassian-bitbucket-1.3.1/bin/bootstrap.jar Using CATALINA_PID: /opt/atlassian/atlassian-bitbucket-1.3.1/work/catalina.pid bin/catalina.sh: line 306: /usr/bin/java/bin/java: Not a directory bin/catalina.sh: line 306: exec: /usr/bin/java/bin/java: cannot execute: Not a directory

Cause

JAVA_HOME is incorrectly set.

Resolution

Set the correct JAVA_HOME as stated in this documentation, under section Is your JAVA_HOME variable set correctly?.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.