How do I configure Stash to use a specific Java?

mickey13 February 14, 2013

How can I specify which Java my installation of Stash should use? I don't want it using my JAVA_HOME. I've tried overwriting my Stash's JAVA_HOME in it's bin/setenv.sh, but that didn't work. Any ideas? Thanks.

2 answers

1 accepted

3 votes
Answer accepted
Stefan Saasen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 14, 2013

Hi Mickey,

In addition to setting the JAVA_HOME environment variable you need to ensure that you set the correct path to the java executable in your PATH.

To check which java executable is used run "which java" or "type java". Make sure you set your PATH environment variable so that the version you want to use comes first.

[4847] λ > which java
/usr/bin/java

[4838] λ > echo $PATH
/Users/ssaasen/.cabal/bin:/Users/ssaasen/.opam/system/bin:/opt/findbugs/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/opt

You could for example define:

export JAVA_HOME=/path/to/java
export PATH=$JAVA_HOME/bin:$PATH

to set both the JAVA_HOME and PATH variables correctly.

HTH.

Cheers,

Stefan

mickey13 February 14, 2013

Thanks for your suggestion. I actually want to have Stash use the same Java as JIRA (the one that comes bundled with JIRA), but I don't want that Java to be the system default. So, I was hoping to avoid setting JAVA_HOME or my PATH variable at all. I figured there has to be a way within Stash's configuration to set which Java to use. Or is it a requirement that Stash use the system JAVA_HOME? Thanks again for your suggestion.

mickey13 February 14, 2013

I'm thinking the only mechanism for specifying which Java to use for Stash is by specifying it in either JAVA_HOME or PATH. Does that sound correct? Thanks.

Stefan Saasen
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
February 15, 2013

Hi,

you should be able to define

export JAVA_HOME=/path/to/java
export PATH=$JAVA_HOME/bin:$PATH

in bin/setenv.sh so it is local to your Stash installation.

You don't have to apply this setting to your user global environment.

HTH.

Cheers,

Stefan

mickey13 February 15, 2013

Thanks, that did help. Just for reference I didn't use "export". Thanks again!

0 votes
mickey13 February 15, 2013

Thanks, that did help. Just for reference I didn't use "export". Thanks again!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events