在linux下安装好tomcat启动时报如下错误:
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
原因:找不到jdk或者jre路径。
解决办法:在setclasspath.bat的开头声明环境变量,打开tomcat的bin目录下面的setclasspath.sh,添加粗体部分,路径修改为自己机器jdk和jre路径即可
# -----------------------------------------------------------------------------
# Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings
# are valid and consistent with the selected start-up options and set up the
# endorsed directory.
# -----------------------------------------------------------------------------
export JAVA_HOME=/usr/java/jdk1.8.0_151
export JRE_HOME=/usr/java/jdk1.8.0_151/jre
"setclasspath.sh" 99L, 3762C written
[root@iZ2ze6cj9rrq7y40sjtli9Z bin]# cd ..
[root@iZ2ze6cj9rrq7y40sjtli9Z apache-tomcat-8.5.24]# ls
bin lib logs RELEASE-NOTES temp work
conf LICENSE NOTICE RUNNING.txt webapps
[root@iZ2ze6cj9rrq7y40sjtli9Z apache-tomcat-8.5.24]# cd bin/
[root@iZ2ze6cj9rrq7y40sjtli9Z bin]# ls