centos启动tomcat报错

[root@localhost web-1]# cd bin
[root@localhost bin]# ls
bootstrap.jar       commons-daemon-native.tar.gz  setclasspath.sh       tool-wrapper.bat
catalina.bat        configtest.bat                shutdown.bat          tool-wrapper.sh
catalina.sh         configtest.sh                 shutdown.sh           version.bat
catalina-tasks.xml  daemon.sh                     startup.bat           version.sh
ciphers.bat         digest.bat                    startup.sh
ciphers.sh          digest.sh                     tomcat-juli.jar
commons-daemon.jar  setclasspath.bat              tomcat-native.tar.gz
[root@localhost bin]# ./catalina.sh run
Using CATALINA_BASE:   /opt/servers/web-1
Using CATALINA_HOME:   /opt/servers/web-1
Using CATALINA_TMPDIR: /opt/servers/web-1/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64
Using CLASSPATH:       /opt/servers/web-1/bin/bootstrap.jar:/opt/servers/web-1/bin/tomcat-juli.jar
./catalina.sh:行422: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64/bin/java: 没有那个文件或目录
[root@localhost bin]# java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
[root@localhost bin]#

下载tomcat,然后解压,启动报上面的错误,

解决的过程中浏览的资料:

https://blog.csdn.net/Steven19920104/article/details/107410998

vim /etc/profile

只是在我本机的profile文件中做了红色部分的修改,红色部分是新增的,

#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64
export JRE_HOME=$JAVA_HOME/jre
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
export JAVA_HOME CLASSPATH PATH

修改好了之后执行 source /etc/profile

重新打开一个终端,然后再运行tomcat,启动成功

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页