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

时间:2024-04-26 11:06:45
[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 -- :: EST; 11s ago
Process: ExecStart=/usr/local/tomcat/bin/startup.sh (code=exited, status=/FAILURE) Feb :: localhost.localdomain systemd[]: Starting Tomcat...
Feb :: localhost.localdomain startup.sh[]: Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
Feb :: localhost.localdomain startup.sh[]: At least one of these environment variable is needed to run this program
Feb :: localhost.localdomain systemd[]: tomcat.service: control process exited, code=exited status=
Feb :: localhost.localdomain systemd[]: Failed to start Tomcat.
Feb :: localhost.localdomain systemd[]: Unit tomcat.service entered failed state.
Feb :: localhost.localdomain systemd[]: tomcat.service failed.

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

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

参考:

https://blog.****.net/to_baidu/article/details/52848620

https://www.cnblogs.com/purplestone/p/3964207.html