Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
2018-03-08 11:25
288 查看
先讲一个Tomcat的问题。很多人兴冲冲的下载了一个Tomcat,跑到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。好,再去下载个最新版本的JDK,Install完成之后却还是提示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的学习热情冷了一半。 原因是后来较新版本的JDK(例如我使用的JDK1.6)安装完不会自动登记环境变量JAVA_HOME,JRE_HOME。像我在单位的环境,我的用户是受限制的(PowerUser),不方便设环境变量,于是我就找到了另外一个方法。 先看Tomcat的startup.bat,它调用了catalina.bat,而catalina.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=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”就大功告成了。转自:http://www.cnblogs.com/nuke/archive/2009/05/11/1454039.html
rem
rem $Id: setclasspath.bat 505241 2007-02-09 10:22:58Z jfclere $
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”就大功告成了。转自:http://www.cnblogs.com/nuke/archive/2009/05/11/1454039.html
相关文章推荐
- tomcat 启动 报错Neither the JAVA_HOME nor the JRE_HOME environment variable is definedtemp
- 解决Linux下启动Tomcat遇到Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- jkd7、tomcat7安装详解。Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 错误解决
- 【Linux】启动Tomcat遇到Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- linux安装tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- 启动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----Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- linux安装tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined ;At least one of these enviro
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined (转)
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 错误&&Eclipse 访问tomcat首页报404错误
- tomcat7.0以上版本运行startup的时候报Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 完美解决(tomcat error)
- Tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
- Neither the JAVA_HOME nor the JRE_HOME environment variable is defined 错误解决
- 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