对于使用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. Orchard源码分析(5.2):BeginRequest事件处理(DefaultOrchardHost.BeginRequest方法)

    BeginRequest事件处理的作用是确保所有Shell已经加载,或者在扩展有变化的时候重新加载.          void IOrchardHost .BeginRequest() {      ...

  2. Linq 操作基础

    参考资料: LINQ系列:LINQ to DataSet的DataTable操作 List<T>转换为DataTable C# DataTable 和List之间相互转换的方法 Linq中 ...

  3. 用jquery写循环播放div的相关笔记 珍贵的总结 -1

    用jquery写循环播放div line-height应用的元素的 层次? line-heig字ht, 叫行高, 仅仅是指 文/文本, 而不管图片. line-height是容器中 文本行 与 文本行 ...

  4. Emacs配置文件

    ;;tab and space;;when true,emacs use mixture of tab and space to archieve(setq-default indent-tabs-m ...

  5. mysql update操作

    update语法 Single-table语法: UPDATE [LOW_PRIORITY] [IGNORE] tbl_name SET col_name1=expr1 [, col_name2=ex ...

  6. IOS表情存入MYSQL数据库失败

    从 MySQL 5.5.3 开始,MySQL 支持一种 utf8mb4 的字符集,这个字符集能够支持 4 字节的 UTF8 编码的字符. utf8mb4 字符集能够完美地向下兼容 utf8 字符串.在 ...

  7. AlwaysOn可用性组功能测试(一)--AlwaysOn故障转移测试

    具体测试环境请参考: AlwaysOn可用性组测试环境安装与配置(一)--SQL群集环境搭建 AlwaysOn可用性组测试环境安装与配置(二)--AlwaysOn配置(界面与T-SQL) 一. Alw ...

  8. javascript string 函数集

    JavaScript_String对象说明 string中文为"字符串"的意思,String继承自Object对象,此对象提供字符串的查找操作等函数 JavaScript字符串类型 ...

  9. Java并发包源码学习之AQS框架(四)AbstractQueuedSynchronizer源码分析

    经过前面几篇文章的铺垫,今天我们终于要看看AQS的庐山真面目了,建议第一次看AbstractQueuedSynchronizer 类源码的朋友可以先看下我前面几篇文章: <Java并发包源码学习 ...

  10. Linux(Ubuntu)安装并破解 SecureFX

    根据Linux(Ubuntu)下面SecureCRT 完全破解(地址:http://www.boll.me/archives/680) 添加了Linux(Ubuntu)下面SecureFX 完全破解, ...