启动tomcat的时候,报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 的解决方案

时间:2023-03-10 06:27:16
启动tomcat的时候,报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 的解决方案

解决方法,如下所示:

先看Tomcat的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat。只要在setclasspath.bat的开头声明环境变量.像我这样 : 加上红色的两句就OK拉 (当然了JAVA_HOME的路径 请填写你自己的)

rem endorsed directory.
rem ---------------------------------------------------------------------------

set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_80

set JRE_HOME=C:\Program Files\Java\jdk1.7.0_80\jre

rem Make sure prerequisite environment variables are set

摘自:http://blog.****.net/hi_kevin/article/details/6602374