`

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined At least

阅读更多

error:

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的startup.bat,它调用了catalina.bat,而catalina.bat则调用了setclasspath.bat。只要在setclasspath.bat的开头声明环境变量,打开tomcat的bin目录下面的setclasspath.sh,添加红色部分,路径自己修改 

#!/bin/sh 
# ----------------------------------------------------------------------------- 
#  Set CLASSPATH and Java options 

#  $Id: setclasspath.sh 467182 2006-10-23 23:47:06Z markt $ 
# ----------------------------------------------------------------------------- 

export JAVA_HOME=/usr/lib/jvm/java-6-sun 
export JRE_HOME=/usr/lib/jvm/java-6-sun/jre 


# First clear out the user classpath 
CLASSPATH= 

# Make sure prerequisite environment variables are set 
if [ -z "$JAVA_HOME" -a -z "$JRE_HOME" ]; then 
  # Bugzilla 37284 
  if $darwin && [ -d "/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home" ]; then 
    export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home" 
  else 
    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" 
    exit 1 
  fi 
fi 
if [ -z "$JAVA_HOME" -a "$1" = "debug" ]; then 
  echo "JAVA_HOME should point to a JDK in order to run in debug mode." 
  exit 1 
fi 
if [ -z "$JRE_HOME" ]; then 
  JRE_HOME="$JAVA_HOME" 
fi 

# If we're running under jdb, we need a full jdk. 
if [ "$1" = "debug" -o "$1" = "javac" ] ; then 
  if [ "$os400" = "true" ]; then 
    if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/javac ]; then 
      echo "The JAVA_HOME environment variable is not defined correctly" 
      echo "This environment variable is needed to run this program" 
      echo "NB: JAVA_HOME should point to a JDK not a JRE" 
      exit 1 
    fi 
  else 
    if [ ! -x "$JAVA_HOME"/bin/java -o ! -x "$JAVA_HOME"/bin/jdb -o ! -x "$JAVA_HOME"/bin/javac ]; then 
      echo "The JAVA_HOME environment variable is not defined correctly" 
      echo "This environment variable is needed to run this program" 
      echo "NB: JAVA_HOME should point to a JDK not a JRE" 
      exit 1 
    fi 
  fi 
fi 
if [ -z "$BASEDIR" ]; then 
  echo "The BASEDIR environment variable is not defined" 
  echo "This environment variable is needed to run this program" 
  exit 1 
fi 
if [ ! -x "$BASEDIR"/bin/setclasspath.sh ]; then 
  if $os400; then 
    # -x will Only work on the os400 if the files are: 
    # 1. owned by the user 
    # 2. owned by the PRIMARY group of the user 
    # this will not work if the user belongs in secondary groups 
    eval 
  else 
    echo "The BASEDIR environment variable is not defined correctly" 
    echo "This environment variable is needed to run this program" 
    exit 1 
  fi 
fi 

# Set the default -Djava.endorsed.dirs argument 
JAVA_ENDORSED_DIRS="$BASEDIR"/endorsed 

# Set standard CLASSPATH 
if [ "$1" = "debug" -o "$1" = "javac" ] ; then 
  CLASSPATH="$JAVA_HOME"/lib/tools.jar 
fi 

# OSX hack to CLASSPATH 
JIKESPATH= 
if [ `uname -s` = "Darwin" ]; then 
  OSXHACK="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes" 
  if [ -d "$OSXHACK" ]; then 
    for i in "$OSXHACK"/*.jar; do 
      JIKESPATH="$JIKESPATH":"$i" 
    done 
  fi 
fi 

# Set standard commands for invoking Java. 
  _RUNJAVA="$JRE_HOME"/bin/java 
if [ "$os400" != "true" ]; then 
  _RUNJDB="$JAVA_HOME"/bin/jdb 
fi 
_RUNJAVAC="$JAVA_HOME"/bin/javac

分享到:
评论
1 楼 lvke 2014-02-22  
没用     

相关推荐

    Kubuntu下安装配置Tomcat

    错误1: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 错误2: Neither the JAVA_HOME nor the JRE_HOME ...

    Neither_Snow_Nor_Rain_Nor_MITM_._._._An_Empirical_Analysis_of

    Neither_Snow_Nor_Rain_Nor_MITM_ 红蓝对抗 安全对抗 业务安全 安全威胁 金融安全

    Java邮件开发Fundamentals of the JavaMail API

    addition, you will need a development environment such as the JDK 1.1.6+ or the Java 2 Platform, Standard Edition (J2SE) 1.2.x or 1.3.x. A general familiarity with object-oriented programming ...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    SSD7 选择题。Multiple-Choice

    (b) the name of the table, the names of the table's attributes, the data types of the table's attributes, the formats of the table's attributes, and the maximum number of rows that the table can have...

    Java+structs快速学习指南

    notEmpty Evaluate the nested body content of this tag if the requested variable is neither null nor an empty string. notEqual Evaluate the nested body content of this tag if the requested variable is ...

    Addison.Wesley.The.Java.Programming.Language.4th.Edition.Aug.2005.chm

    That said, this book is neither a comparative analysis nor a "bridge" tutorialno knowledge of C or C++ is assumed. C++ programmers, especially, may be as hindered by what they must unlearn as they ...

    The irrationals: a story of the numbers you can't count on

    The ancient Greeks discovered them, but it wasn't until the nineteenth century that irrational numbers were properly understood and rigorously defined, and even today not all their mysteries have been...

    so nor neither的用法总结PPT学习教案.pptx

    so nor neither的用法总结PPT学习教案.pptx

    a project model for the FreeBSD Project.7z

    [1] This paper will provide such a project model and is donated to the FreeBSD Documentation project where it can evolve together with the project so that it can at any point in time reflect the way ...

    The Princeton Companion To Mathematics

    the two propositions, and neither p nor q contains any constants except logical constants. And logical constants are all notions definable in terms of the following: Implication, the relation of a ...

    netWindows_0.3.0_pre2

    Neither the names of Licensor, nor the names ofany contributors to the Original Work, nor any of their trademarks or servicemarks, may be used to endorse or promote products derived from this ...

    unrxlib_275_u_1_0_13

    the author(s) nor anybody connected to this software in any way can assume any responsibility. * All rights held by the author(s) or owner(s) of units or documents. _______________________________...

    ACM的一道题--Parenthesize the string

    Notice that the multiplication operation defined by the table is neither associative nor commutative. a b c a b b a b c b a c a c c Find an efficient algorithm that examines a string of these ...

    Lectures on Discrete and Polyhedral Geometry

    Let us emphasize that this is neither a research monograph nor a comprehensive survey of results in the field. The exposition is at times completely elementary and at times somewhat informal. Some ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    This is because static data members are defined outside the class definition. On the other hand, you must include the header file for Foo if your class subclasses Foo or has a data member of type ...

    Java Data Science Made Easy

    Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this course. Packt Publishing ...

    Springer Mathematical Aspects of Computer and Information Sciences

    Neither the publisher nor the authors or the editors give a warranty, express or implied, with respect to the material contained herein or for any errors or omissions that may have been made. The ...

    计算机网络第六版答案

    Any system that is part of the botnet can automatically scan its environment and propagate by exploiting the vulnerability. An important property of such botnets is that the originator of the botnet ...

    Neither...nor的用法小结.doc

    Neither...nor的用法小结.doc

Global site tag (gtag.js) - Google Analytics