[root@localhost META-INF]# systemctl start tomcat
Job for tomcat.service failed because the control process exited with error code. See "systemctl status tomcat.service" and "journalctl -xe" for details.
[root@localhost META-INF]# systemctl status tomcat.service
● tomcat.service - Tomcat
   Loaded: loaded (/usr/lib/systemd/system/tomcat.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2019-02-19 12:12:06 EST; 11s ago
  Process: 7551 ExecStart=/usr/local/tomcat/bin/startup.sh (code=exited, status=1/FAILURE)

Feb 19 12:12:06 localhost.localdomain systemd[1]: Starting Tomcat...
Feb 19 12:12:06 localhost.localdomain startup.sh[7551]: Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
Feb 19 12:12:06 localhost.localdomain startup.sh[7551]: At least one of these environment variable is needed to run this program
Feb 19 12:12:06 localhost.localdomain systemd[1]: tomcat.service: control process exited, code=exited status=1
Feb 19 12:12:06 localhost.localdomain systemd[1]: Failed to start Tomcat.
Feb 19 12:12:06 localhost.localdomain systemd[1]: Unit tomcat.service entered failed state.
Feb 19 12:12:06 localhost.localdomain systemd[1]: tomcat.service failed.

 

打开tomcat的bin目录下的setclasspath.sh,手动加入两个环境变量

启动tomcat    报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined_html