It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

start-jira.sh cannot find JAVA_HOME even though it is set

Jared Tyler Jan 09, 2012

When I run bin/start-jira.sh, it displays, "Neither the JAVA_HOME nor the JRE_HOME environment variable is defined." Both of these env variables are set. Despite this, I looked into the file bin/setclasspath.sh, where that error message originates. At line 32, it executes which java 2>/dev/null in order to try to find the java home directory on its own. From within the script (which I have confirmed by echoing that command's return value), that returns a blank. However, when I run that command from outside the shell script, it accurately gives me the location of the java executable.

I have also echoed the value of $JAVA_HOME and $JRE_HOME, both of which have their appropriate values, but from within the script they appear to be empty. I can't figure out why this is happening. Any ideas?

2 answers

1 accepted

2 votes
Answer accepted
Tam Nguyen Jan 09, 2012

Make sure you define JAVA_HOME in ~/.bashrc . Anyway there is a workaround, create and execute a script like bellow

#!/bin/bash

export JAVA_HOME=<JAVA HOME>
<JIRA-INSTALL>/bin/start-jira.sh

Jared Tyler Jan 09, 2012

Thanks for the reply, Tam. JAVA_HOME is already defined appropriately in /etc/bashrc and it has the proper value immediately upon login.

Your workaround worked wonders though! I have no idea why that worked, but thank you. :)

Tam Nguyen Jan 10, 2012

You are welcome!.

The problem here is the difference between /etc/profile and /etc/bashrc, they are similar but /etc/profile is used for login shells and /etc/bashrc is used for non-login shells. I guess you execute start-jira.sh by login user (maybe root) so it loads /etc/profile not /etc/bashrc. Define JAVA_HOME in /etc/profile then try to run start-jira.sh again, let me know if this works for you.

Cheers,

Jared Tyler Jan 15, 2012

Hey Tam, sorry I forgot to come back and let you know how it went. I defined JAVA_HOME in /etc/profile as well as /etc/bashrc (no point in removing that one, I feel) and stopped using the wrapper script workaround, and everything worked fine.

I didn't realize that about the difference between /etc/bashrc and /etc/profile, but now I know! Thanks a ton, this is definitely going to be an influential contribution of yours to my knowledge of Linux.

5 votes
HomeAway Mar 12, 2014

For anyone else that stumbles upon this because they renamed the install folder after an upgrade or a server migration. Getting old referencees to JRE_HOME? It's in <install>/bin/permgen.sh

Daniel Eads [non-monitored account] Community Leader Sep 22, 2015

Spot on. Thanks!

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Jira

Try Jira Cloud for Outlook: Organize your work without leaving your inbox

Hi Atlassian community, My name is Max and I work on the product integration team at Atlassian. I am pleased to announce the early access program for the Jira Cloud add-in for Outlook. This add-in...

793 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you