[转]启动tomcat时报Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 的解决方案

解决方法: 

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

 

rem —————————————————————————

rem Set CLASSPATH and Java options

rem

rem $Id: setclasspath.bat 795032 2009-07-17 10:41:20Z markt $

rem —————————————————————————

 

set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_10

set JRE_HOME=C:\Program Files\Java\jdk1.6.0_10\jre

 

rem Make sure prerequisite environment variables are set

if not "%JAVA_HOME%" == "" goto gotJdkHome

if not "%JRE_HOME%" == "" goto gotJreHome

echo Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

echo At least one of these environment variable is needed to run this program

goto exit

posted @ 2012-05-09 19:25  hdu2012  阅读(4331)  评论(0编辑  收藏  举报