export JAVA_HOME=/home/tomcat/jdk1.8.0_121
export JRE_HOME=${JAVA_HOME}/jre
export CATALINA_HOME=${HOME}/apache-tomcat-9.0.0.M17
export CATALINA_BASE=${HOME}/apache-tomcat-9.0.0.M17
export CATALINA_TMPDIR=${CATALINA_HOME}/temp
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:${CATALINA_HOME}/common/lib/servlet-api.jar
export PATH=${JAVA_HOME}/bin:$PATH
在上述配置完成环境变量后,命令行执行java提示
- Error occurred during initialization of VM
- Could not allocate metaspace: 1073741824 bytes
可能由于系统64位兼容性问题,果断下个jdk1.8.0 32位包解压配置后,替换原来的64位jdk,java正常使用。