|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
tomcat 启动的批处理文件startup.bat\catalina.bat\setclasspath.bat用批处理文件查找启动
问题
catalina.bat
rem ----- Execute The Requested Command ---------------------------------------
echo Using CATALINA_BASE: "%CATALINA_BASE%"
echo Using CATALINA_HOME: "%CATALINA_HOME%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"
if ""%1"" == ""debug"" goto use_jdk
echo Using JRE_HOME: "%JRE_HOME%"
goto java_dir_displayed
:use_jdk
echo Using JAVA_HOME: "%JAVA_HOME%"
:java_dir_displayed
echo Using CLASSPATH: "%CLASSPATH%"
==========================================
从tomcat的bin目录下启动startup.bat 结果tomcat一闪而过,留下华丽的身影,为什么呢?
先看Tomcat的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat
。只要在setclasspath.bat的开头声明环境变量,如我的就是:
先讲一个Tomcat的问题。到bin看到一个startup.bat就去执行,结果提示
C:\tomcat-6.0.35\bin>C:\tomcat-6.0.35\bin\startup.bat
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
原因是后来较新版本安装完不会自动登记环境变量JAVA_HOME,JRE_HOME。
先看Tomcat的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat
。只要在setclasspath.bat的开头声明环境变量(红色两行),如我的就是:
只要在setclasspath.bat的开头声明环境变量,如我的就是:
rem ---------------------------------------------------------------------------
rem Set CLASSPATH and Java options
rem
rem $Id: setclasspath.bat 505241 2007-02-09 10:22:58Z jfclere $
rem ---------------------------------------------------------------------------
set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_20
set JRE_HOME=C:\Program Files\Java\jre6
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
......
这样在每次运行startup.bat时就自动注册了JAVA_HOME,JRE_HOME。
运行startup.bat,提示“信息:Server startup in xxxxx ms” OK 大功告成。
=====================
3.输入if not exist "%JAVA_HOME%\bin\java.exe" echo "%JAVA_HOME%\bin\java.exe" 回车
结果:"D:\pro\javajdk1.6;\bin\java.exe" 看到没,这个给你打印出了你的环境变量的全路径
,我居然多了个分号!!真该死,检查出来了,环境变量多了个分号,他就找不到了。去掉分号
,然后再次尝试就OK了。
============================
C:\tomcat-6.0.35\bin>C:\tomcat-6.0.35\bin\startup.bat
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
C:\tomcat-6.0.35\bin>if not exist "%JAVA_HOME%\bin\java.exe" echo "%JAVA_HOME%\b
in\java.exe"
"C:\Program Files\Java\jdk1.7.0\bin\bin\java.exe"
C:\tomcat-6.0.35\bin>set JAVA_HOME=
C:\tomcat-6.0.35\bin>if not exist "%JAVA_HOME%\bin\java.exe" echo "%JAVA_HOME%\b
in\java.exe"
"%JAVA_HOME%\bin\java.exe"
C:\tomcat-6.0.35\bin>C:\tomcat-6.0.35\bin\startup.bat
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
C:\tomcat-6.0.35\bin>C:\tomcat-6.0.35\bin\startup.bat
Using CATALINA_BASE: "C:\tomcat-6.0.35"
Using CATALINA_HOME: "C:\tomcat-6.0.35"
Using CATALINA_TMPDIR: "C:\tomcat-6.0.35\temp"
Using JRE_HOME: "C:\Program Files\Java\jre7\bin"
Using CLASSPATH: "C:\tomcat-6.0.35\bin\bootstrap.jar"
C:\tomcat-6.0.35\bin>
=========================================================
或者批一下
e:
cd E:\Software\apache-tomcat-6.0.29\bin
java -jar -Xms256m -Xmx1024m bootstrap.jar stop
===================================
|
|