对于使用IDE开发的程序员来讲,并不是所有人都对自己用来吃饭的工具了如指掌。常在阴沟跑,哪能不翻船。为此我把自己使用Tomcat/Eclipse的一些经验教训整理了一下,会陆续的贴出来,也许会帮到和我遇到同样问题的人。

先讲一个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=C:\Program Files\Java\jdk1.8.0_92
set JRE_HOME=C:\Program Files\Java\jre1.8.0_101

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 defined的更多相关文章

  1. linux安装tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    这两天我们的开发机重启了好几次,发现每次重启后我的tomcat总是没有启动.检查java路径,配置正确,后来拿普通账号启动tomcat时报如下的错: Neither the JAVA_HOME nor ...

  2. Tomcat Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    一眼就能看出来是jdk的环境有问题,但是用了这么久的jdk一直都配置的好好的,怎么一到Tomcat上就这么矫情了. 最后查解决方案,原来是我的jdk从官网直接下载的,虽然我修改了java_home,但 ...

  3. tomcat启动报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least one of these environment variable

    linux 下 启动tomcat 报: Neither the JAVA_HOME nor the JRE_HOME environment variable is definedAt least o ...

  4. 启动tomcat 报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    [root@localhost META-INF]# systemctl start tomcat Job for tomcat.service failed because the control ...

  5. 普通用户操作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 At ...

  6. tomcat启动报错:Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

      windows系统: 部署了一个Tomcat8.5.15,bin目录下startup.bat执行,结果提示Neither the JAVA_HOME nor the JRE_HOME enviro ...

  7. CentOS Tomcat启动 Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

    链接:http://blog.csdn.net/shangdiyisi/article/details/9477521 [bravoinfo@bravoinfo-hk-01 apache-tomcat ...

  8. Jenkins启动Tomcat时提示Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

      Jenkins构建提示: [SSH] executing...Neither the JAVA_HOME nor the JRE_HOME environment variable is defi ...

  9. 解决JAVA_HOME nor the JRE_HOME environment variable is defined

    从别的地方复制了一个tomcat, 启动后一闪即退, 使用记事本打开 startup.bat文件, 在文件底部修改, 并追加如下内容 call "%EXECUTABLE%" run ...

随机推荐

  1. HTML5 web Form表单验证实例

    HTML5 web Form 的开发实例! index.html <!DOCTYPE html> <html> <head> <meta charset=&q ...

  2. poj3254 Corn Fields (状压DP)

    http://poj.org/problem?id=3254 Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissio ...

  3. javascript客户端检测技术

    1. Firefox  Gecko是firefox的呈现引擎.当初的Gecko是作为通用Mozilla浏览器一部分开发的,而第一个采用Gecko引擎的浏览器是Netscape6: 我们可以使用用户代理 ...

  4. JSON的parse()和stringfy()方法

    1.JSON.parse; 作用:将JavaScript对象表示法的JSON字符串转换为对象(字符串转对象). 语法:JSON.parse(text [, reviver]) text 必选. 一个有 ...

  5. Express开发实例(2) —— Jade模板引擎

    前一篇通过helloworld,简单介绍了Express中的开发,本篇继续深入的学习express的模板. 关于Jade的用法,网上有很多,本篇参考:Jade语法 安装相关模块 在实验代码前,应该先安 ...

  6. iOS: Crash文件解析(一)

    iOS Crash文件的解析(一) 开发程序的过程中不管我们已经如何小心,总是会在不经意间遇到程序闪退.脑补一下当你在一群人面前自信的拿着你的App做功能预演的时候,流畅的操作被无情地Crash打断. ...

  7. codevs4096 删数问题

    题目描述 Description 键盘输入一个高精度的正整数N,去掉其中任意S个数字后剩下的数字按原左右次序将组成一个新的正整数.编程对给定的N 和S,寻找一种方案使得剩下的数字组成的新数最小. 输入 ...

  8. 关于QString::toWCharArray 无法解析的外部符号

    1>CommManger.obj : error LNK2019: 无法解析的外部符号 "public: int __thiscall QString::toWCharArray(un ...

  9. UML之用例图

    用例图概要 ²用例图是被称为参与者的外部用户所能观察到的系统功能的模型图. (<UML参考手册>) ²用例图列出系统中的用例和系统外的参与者,并显示哪个参与者参与了哪个用例的执行 (或称为 ...

  10. Linux程序编写shell script的格式

    #!/bin/bash #program # 在此处写下此程序的作用 #History: #此处写下写此程序的时间 作者 版本号 PATH=/bin:/sbin:/usr/bin:/usr/sbin: ...