I'm running into a problem when migrate to run my Springboot app from Amazon linux 1 to Amazon linux 2. I'm using run file with select the Java version by JAVA_HOME:
- Amazon linux 1: JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk.x86_64
- Amazon linux 2: JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.amzn2.0.1.x86_64/jre/bin/java
Every thing work normal in Amazon linux 1 but in Amazon linux 2, I got the Unsupported major.minor version 52.0 error. What really confuse me is that when I change the whole java version of the instance (attached image) then everything is running ok again.
I'm guessing the problem is how I point to the java jre but I can't figure it out. Can somebody please help me with this. Thanks in advance.
Edit 1: The sh file i use to run:
#!/bin/sh
exec 2>&1
ulimit -n 10240
#For Java Classpath
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.amzn2.0.1.x86_64/jre/bin/java
JAVA_BIN=$JAVA_HOME/bin/
export JAVA_HOME
EXTERNAL_HOME=external
EXTERNAL_RESOURCE=$EXTERNAL_HOME/resources
export SPRING_CONFIG_NAME=application
export SPRING_CONFIG_LOCATION=$EXTERNAL_RESOURCE/
export LOG_DIR=$EXTERNAL_HOME/logs
export LANG=ja_JP.UTF-8
cd $EXTERNAL_HOME
echo $SPRING_CONFIG_NAME
echo $SPRING_CONFIG_LOCATION
echo $LOG_DIR
#exec nice -n 20 java -server -Xmx512M -Xms256M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar external-0.0.1.jar
#exec nice -n 20 java -server -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005 -jar external-0.0.1.jar
exec nice -n 20 java -server -Xmx512M -Xms256M -Dlogging.config=file:$EXTERNAL_RESOURCE/log4j2.properties \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar external-0.0.1.jar