tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

error:

An error is reported when starting and closing tomcat under Linux, as shown in the following figure:



 

 

In the past two days, our development machine has been restarted several times, and I found that my tomcat never started after each restart.
It turned out that the jdk I used was not installed through yum, but I downloaded it directly from the official website. Although I modified java_home, the less intelligent tomcat still did not automatically recognize the java_home path.

Solution:
Edit the file /usr/local/apache-tomcat-8.5.29/bin/catalina.sh (modify according to your own jdk path) At the beginning of the body of the file, that is, before the official code, add the following on line 99 code

export JAVA_HOME=/usr/local/java/jdk1.8.0_161
export JRE_HOME=/usr/local/java/jdk1.8.0_161/jre

 

Note: Please modify the corresponding catalina.bat under Windows

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174510&siteId=291194637