Cannot find tomcat目录/bin/setclasspath.sh This file is needed to run this program

时间:2023-03-08 20:48:51

首先如果直接使用 root 用户来启动 tomcat 的话,是可以正常启动的。

但是我们在 Linux 中使用普通用户启动 tomcat 报了如下错误

Cannot find /developer/apache-tomcat-8.5.50/bin/setclasspath.sh
This file is needed to run this program

原因是没有在 setclasspath.sh 上设置 JAVA_HOME 和 JRE_HOME。

解决办法:

打开 setclasspath.sh

sudo vi setclasspath.sh

然后设置 JAVA_HOME 和 JRE_HOME

Cannot find tomcat目录/bin/setclasspath.sh This file is needed to run this program

然后再使用命令 sudo ./startup.sh 重新启动 tomcat

关闭的话也要使用 sudo ./shutdown.sh 来关闭,否则会报上面的错误