How do I set the JAVA HOME Variable?
Asked by Christopher Miller:

Directions aren't clear. How do I successfully set JAVA_HOME path in CentOS 7 x86_64. This is a VM that I'm testing a Bamboo v7.1.2 install.

This is my output for Java version and where Java is installed for CentOS 7.

```
[root@centos7-bamboo atlassian-bamboo]# java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)


[root@centos7-bamboo atlassian-bamboo]# whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz

```

I've run the following command to confirm what Java is installed and the path:

```
[root@centos7-bamboo bin]# alternatives --config java

There is 1 program that provides 'java'.

Selection Command
-----------------------------------------------
*+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number:
```

I need this ran for all users globally, so I'm putting this info under /etc/profile.

```
[root@centos7-bamboo bin]# alternatives --config java

There is 1 program that provides 'java'.

Selection Command
-----------------------------------------------
*+ 1 java-1.8.0-openjdk.x86_64 (/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/bin/java)

Enter to keep the current selection[+], or type selection number:
```

When trying to run Bamboo, this is the output, which I know isn't successfully started:

```
[root@centos7-bamboo bin]# ./start-bamboo.sh

To run Bamboo in the foreground, start the server with start-bamboo.sh -fg

Server startup logs are located in /opt/bamboo/atlassian-bamboo-7.1.2/bin/logs/catalina.out

Bamboo Server Edition
Version : 7.1.2

If you encounter issues starting or stopping Bamboo Server, please see the Troubleshooting guide at https://confluence.atlassian.com/display/BAMBOO/Installing+and+upgrading+Bamboo

Using CATALINA_BASE: /opt/bamboo/atlassian-bamboo-7.1.2
Using CATALINA_HOME: /opt/bamboo/atlassian-bamboo-7.1.2
Using CATALINA_TMPDIR: /opt/bamboo/atlassian-bamboo-7.1.2/temp
Using JRE_HOME: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64
Using CLASSPATH: /opt/bamboo/atlassian-bamboo-7.1.2/bin/bootstrap.jar:/opt/bamboo/atlassian-bamboo-7.1.2/bin/tomcat-juli.jar
Tomcat started.
```

The catalina.out log shows the following:

```
/opt/bamboo/atlassian-bamboo-7.1.2/bin/catalina.sh: line 505: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/bin/java: No such file or directory
```


Answers:
author: Christopher Miller
body: I was able to get Bamboo to start, however I'm getting the following error:

```
java.lang.IllegalStateException: Unsupported Java version 15 detected 
```

I followed the directions that I found here:

<http://howto.basjes.nl/linux/installing-my-new-server/Various-software>

But I installed directly from Oracle: jdf-15_linux-x64_bin.rpm

Once I installed this rpm, it created /usr/java/share and I changed the path under /etc/profile and Bamboo starts, but doesn't have the correct version of Java.

But the version of Java that came with CentOS 7 doesn't have a directory under /usr/java/share.

Is there a way to get around this or fix this? Maybe a soft link under /usr/java/share that points to /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.262.b10-0.el7_8.x86_64/jre/bin/java ?


Tags: centos

java

java_home