How to set JAVA_HOME correctly on CentOS?

You want to point JAVA_HOME to the JRE directory, as in:

JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64/jre/

If using bash, I recommend putting this in /etc/bashrc (RH based) or /etc/bash.bashrc (Debian based):

export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:/bin/java::")

Rather than copying out files from the installation directory it would be better to set the SOLR_JAVA_HOME in /etc/default/solr.in.sh to the location of the jre folder in your installation such as usr/lib/jvm/java-1.8.0-openjdk-1.8.0.65-0.b17.el6_7.x86_64/jre/

Tags:

Java

Centos

Jdk