• Neither the JAVA_HOME or the JRE_HOME environmental variable is defined 解决方案


    从 tomcat的bin目录下启动startup.bat 结果tomcat一闪而过,留下华丽的身影,为什么呢?先看Tomcat的startup.bat,它调用了catalina.bat,而 catalina.bat则调用了setclasspath.bat。只要在setclasspath.bat的开头声明环境变量,如我的就是:

    先讲一个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

    原因是后来较新版本安装完不会自动登记环境变量JAVA_HOME,JRE_HOME。

    先看Tomcat的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.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.6.0_20

    set JRE_HOME=C:\Program Files\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。

    运行startup.bat,提示“信息:Server startup in xxxxx ms”  OK 大功告成。

  • 相关阅读:
    在source insight中阅读Python代码
    修改linux命令行提示符
    gcc链接程序时出现undefined reference to""错误
    [转]init.d解析
    [转]Linux中find常见用法示例
    Linux的网卡由eth0变成了eth1,如何修复?
    测试使用Windows Live Writer
    黑盒测试
    白盒测试技术(二)
    白盒测试技术(一)
  • 原文地址:https://www.cnblogs.com/wshan/p/3068710.html
Copyright © 2020-2023  润新知