How do I configure Stash to use a specific Java?

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

This widget could not be displayed.

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

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.

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.

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

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

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 3 hours ago in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

14 views 0 4
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you