Issue
I am running Bamboo on CentOS 7. My JAVA_HOME/bin/java
and java
commands refer to the same thing, and they are set properly:
~$ echo $JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre
~$
I am also setting my JAVA_HOME
variable in .bash_profile
. I have put it in <bamboo installation dir>/bin/setenv.sh
too. However, in my Maven tasks in Bamboo fail with:
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
I don't know how to debug this and how can I provide any further information. When I ssh into the server that Bamboo is installed, I can run mvn
commands without any issues.
Solution
So, it is not about how you set the JAVA_HOME
variable for Bamboo, but it's about how Bamboo sets its JAVA_HOME
variable for it's java executable. It is in the database. It was the value before I made an update to java and deleted the old version and I have changed it from Bamboo administration > JDKs
to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre
and done, the issue is resolved.
Answered By - Hasan Can Saral
Answer Checked By - Terry (JavaFixing Volunteer)