0
$ sudo ./bin/catalina.sh run
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

/etc/profile 中配置好了所有的环境变量, 为什么还会报错误?

# java environment
export JAVA_HOME="/usr/local/java/jdk1.8.0_144"
export JRE_HOME="$JAVA_HOME/jre"
export CLASSPATH=".:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib"
export PATH="$JAVA_HOME/bin:$JRE_HOME/bin:$PATH"

搜索解决办法时只说去Tomcat的运行文件catalina.sh中添加JAVA_HOME和JRE_HOME两个变量即可运行, 这样切换版本的时候会比较繁琐.

上述错误只在使用root权限启动时发生的? 是否和用户有关?

$ sudo ./catalina.sh run
./catalina.sh: line 108: uname: command not found
./catalina.sh: line 129: dirname: command not found
Cannot find //bin/setclasspath.sh
This file is needed to run this program

正常启动后又报这个错误?
键入查看uname和dirname命令都有.

... Tomcat 是怎么了?

查看全部 3 个回答

0

配置完有没有执行source命令