Tomcat在命令行 配置startup.bat时出现:neither the java_home nor jre_hom

来源:互联网 发布:最新小米抢购软件 编辑:程序博客网 时间:2024/06/05 16:10

解决办法:

先看Tomcat的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat.只要在setclasspath.bat的开头声明环境变量,如我的就是:

​rem —————————————————————————

rem Set CLASSPATH and Java options

​rem

​rem Id:setclasspath.bat5052412007020910:22:58Zjfclere

​rem —————————————————————————
​set JAVA_HOME=D:\Java\jdk1.6.0_11

​set JRE_HOME=D:\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.控制台窗口关闭后,这两个变量也将消失,不会再占用内存.运行一下,最终提示“信息:Server startup in xxxxx ms”就大功告成了.​

借鉴自网友四叶草6143,谢谢他的帮助,原网页:http://www.zybang.com/question/2f040847220f66df1e3fb80463c1f6ca.html?fr=iks&word=neither+the+JAVA_HOME+nor+JRE_HOME+environment+variable&ie=gbk

0 0