terwer@terwer-PC:~$ cd /opt/*tomcat*/bin
terwer@terwer-PC:/opt/apache-tomcat-9.0.13/bin$ sudo chmod u+x ./*.sh
提示无JAVA_HOME,但是我已经设置了JAVA_HOME
terwer@terwer-PC:/opt/apache-tomcat-9.0.13/bin$ sudo ./startup.sh
[sudo] terwer 的密码:
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
编辑 setclasspath.sh
,在顶部添加下面的内容
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_191
export JRE_HOME=/usr/lib/jvm/jdk1.8.0_191/jre
此时已经可以了
terwer@terwer-PC:/opt/apache-tomcat-9.0.13/bin$ sudo ./startup.sh
Using CATALINA_BASE: /opt/apache-tomcat-9.0.13
Using CATALINA_HOME: /opt/apache-tomcat-9.0.13
Using CATALINA_TMPDIR: /opt/apache-tomcat-9.0.13/temp
Using JRE_HOME: /usr/lib/jvm/jdk1.8.0_191/jre
Using CLASSPATH: /opt/apache-tomcat-9.0.13/bin/bootstrap.jar:/opt/apache-tomcat-9.0.13/bin/tomcat-juli.jar
Tomcat started.