Neither the JAVA_HOME nor the JRE_HOME错误解决

Tomcat安装配置:

双击安装到c盘后。

跑到C:\apache-tomcat-7.0.26\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.7)安装完不会自动登记环境变量JAVA_HOME,JRE_HOME。像我在单位的环境,我的用户是受限制的(PowerUser),不方便设环境变量,于是我就找到了另外一个方法。

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

rem ---------------------------------------------------------------------------
rem Set CLASSPATH and Javaoptions
rem
rem $Id: setclasspath.bat 505241 2007-02-09 10:22:58Z jfclere $
rem ---------------------------------------------------------------------------

set JAVA_HOME=C:/Program Files/Java/jdk1.7.0_02
set JRE_HOME=C:/Program Files/Java/jre7

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”就大功告成了。

时间: 2024-08-07 21:19:16

Neither the JAVA_HOME nor the JRE_HOME错误解决的相关文章

转:Tomcat启动过程中找不到JAVA_HOME JRE_HOME的解决方法

转自:http://blog.sina.com.cn/s/blog_61c006ea0100l1u6.html 原文: 在XP上明明已经安装了JDK1.5并设置好了JAVA_HOME,可偏偏Tomcat在启动过程中找不到.    报错信息如下:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable is needed to r

Ubuntu 配置 Tomcat与日常错误解决

系统环境:Ubuntu 14.10 安装版本:apache-tomcat-7.0.54.tar.gz 安装步骤: 1.下载 Tomcat 下载 apache-tomcat-7.0.54.tar.gz 2.解压 Tomcat 点击用归档管理器打开,将其解压到home目录下,为方便起见,将文件夹名字改为tomcat 3.配置 Tomcat 打开启动的脚本文件 sudo vi ./bin/startup.sh 添加 jdk 和 jre 环境变量,如下图红色矩形区域: 直接复制: [html] view

ubuntu14.04安装hadoop2.7.1伪分布式和错误解决

ubuntu14.04安装hadoop2.7.1伪分布式和错误解决需要说明的是我下载的是源码,通过编译源码并安装一.需要准备的软件:1.JDK和GCC    设置JAVA_HOME:        vim ~/.bashrc        在最后增加:export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_31,保存退出.        使设置立即生效:source ~/.bashrc        测试JAVA_HOME是否设置成功,输出了上面设置的路径表示成功:    

Linux下tomcat启动Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of

在linux下安装好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 原因:找不到jdk或者jre路径. 解决办法:在setclasspath.bat的开头声明环境变量,打开tomcat的bin目录下面的setclasspath.

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

linux下,关闭和重启tomcat时报错: Neither the JAVA_HOME nor the JRE_HOME environment variable is definedAt least one of these environment variable is needed to run this program 我的tomcat以前是正常的,突然重启下tomcat时报了这个错,错误大致是环境变量不可用造成的, 在网上找了很久都是说要修改setclasspath.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

开启tomcat时出现以上错误 // 进入root帐户 在普通用户也可以 sudo -s //用编辑器打开.bashrc文件 gedit .bashrc 在普通用户下注意加上sudo //在最后一行添加环境变量(文件位置根据自己的实际情况) JAVA_HOME=/usr/local/java/jdk1.7.0_67CLASSPATH=.:/usr/local/java/jdk1.7.0_67/libJRE_HOME=/usr/local/java/jdk1.7.0_67/jrePATH=$PAT

windows 启动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 definedAt least one of these environment variable is needed to run this program 解决方法: 找到tomcat 安装目录bin下的setclasspath.bat文件,打开后,新加如下配置: set JAVA_HOME=C:\Program Files\Java\j

This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' 错误解决

原因是内层select语句带有limit子句. 原: update stu_score_childen A  set  A.fScore='-1' where  A.fID in (select B.fID from stu_score_childen B limit 0,50 ) 更改后的 update stu_score_childen A  set  A.fScore='-1' where  A.fID in (select C.fID from (select B.fID from st

【Oracle】ora-12541错误解决

ORA-12541: TNS无监听程序错误 1.在oracle安装目录下查找listener.ora和tnsnames.ora文件,然后打开 2.将host改为机器名 3.执行命令:lsnrctl stop,再执行lsnrctl start. [Oracle]ora-12541错误解决,布布扣,bubuko.com