The file /etc/sysconfig/eap7-standalone provides a way to set the JAVA_HOME.
For instance, it was set to
# Uncomment the following for location of java in the SDK
JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64
However, the server still fails to start:
# service eap7-standalone start Starting eap7-standalone: [FAILED] Please ensure alternatives is set to use Java specification version 1.8 or later.
This is caused by this line in the init script itself /etc/rc.d/init.d/eap7-standalone
if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then export PATH=$PATH:$JAVAPTH fi
Usually PATH already has 'java' which in this machine was from a Java 6, and the service fals to start.
These lines should be:
if [ -z "`echo $PATH | grep $JAVAPTH`" ]; then export PATH=$JAVAPTH:$PATH fi
So the intended settings override whatever was there previously.
With this change the server starts normally:
# service eap7-standalone start Starting eap7-standalone: [ OK ]
Note: JAVAPTH is set from JAVA_HOME some lines above:
#make sure java is on your path
JAVAPTH=${JAVAPTH:-"$JAVA_HOME/bin"}