`
sdusjy
  • 浏览: 28172 次
  • 性别: Icon_minigender_1
  • 来自: 济南
社区版块
存档分类
最新评论

tomcat error: Neither the JAVA_HOME nor the JRE_HOME environment variable is defin

 
阅读更多
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

转自:http://linghongli.iteye.com/blog/61530
分享到:
评论

相关推荐

    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_ 红蓝对抗 安全对抗 业务安全 安全威胁 金融安全

    .NET上机实验报告

    上机实验报告(1) 句型以及其倒装使用 2008年6月翻译真题第91题: __________________________(直到他完成使命)did he realize that he was seriously ill. (Key:Not until he ...Neither…..nor……..

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

    例如:Neither dad nor mum is at home today. 今天父母都不在家。 需要注意的是,当主语不是同一个人或物时,nor 和 neither 可互换,例如:I don't know, nor do I care. 我不知道,也不关心。但是,当主语是同一...

    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$ ... 命令和参数之间必需用空格隔...

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

    so nor neither的用法总结 So 和 Nor/Neither 是英语语法中两个重要的连接词,分别用于表示肯定和否定关系。本文将对 So 和 Nor/Neither 的用法进行总结,并提供实例来帮助读者更好地理解和掌握它们的使用。 一、...

    Linux 初始化MySQL 数据库报错解决办法

    Neither host 'localhost.localdomain' nor 'localhost' could be looked up with /usr/bin/resolveip Please configure the 'hostname' command to return a correct hostname. 错误:  解决办法 1、查看/etc/...

    中考英语主谓一致PPT课件.pptx

    在并列主语中,使用or、either…or、neither…nor、not only…but also等连接词时,谓语动词与靠近它的主语一致。 例如:Either you or I_____ (be) mad. Either the teacher or the students (be) to blame. 二、...

    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 ...

    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...

    php.ini-development

    The PHPRC environment variable. (As of PHP 5.2.0) ; 3. A number of predefined registry keys on Windows (As of PHP 5.2.0) ; 4. Current working directory (except CLI) ; 5. The web server's directory ...

    memcached 1.2.6 1.2.5

    Neither library has been modified from the respective released version other than to add win32 required changes. I released them here simply because I found no buildable win32 versions for these ...

    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 ...

    Tomcat9安装windows服务的详细教程

    2.设置tomcat服务名称 搜索”set SERVICE_NAME=”,设置tomcat服务名称 set SERVICE_NAME=Tomcat9_8080 3.设置tomcat服务显示名称 搜索”DisplayName”,修改tomcat服务显示名称 4.添加tomcat到windows服务方式一 ...

    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 ...

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

    That definition seems so simple: they are numbers that cannot be expressed as a ratio of two integers, or that have decimal expansions that are neither infinite nor recurring. But, as The Irrationals...

    10.23图片上传callablestmt存储过程.rar

    用的是sql2000数据库,实现图片上传!

    JAVA反编译软件

    This is README file for Java Decompiler. JD home page: http://java.decompiler.free.fr Copyright 2008 Emmanuel Dupuy. 1. Installation. No installation and no setup are required. 2. Description JD-GUI...

    I2cMatsterVerilog.rar

    This version of the 1992 I2C-bus specification includes the following modifications: • Programming of a ...NOTE: Neither the 100 kbit/s I2C-bus system nor the 100 kbit/s devices have been changed.

Global site tag (gtag.js) - Google Analytics