Chinaunix首页 | 论坛 | 博客
  • 博客访问: 7093495
  • 博文数量: 3857
  • 博客积分: 6409
  • 博客等级: 准将
  • 技术积分: 15948
  • 用 户 组: 普通用户
  • 注册时间: 2008-09-02 16:48
个人简介

迷彩 潜伏 隐蔽 伪装

文章分类

全部博文(3857)

文章存档

2017年(5)

2016年(63)

2015年(927)

2014年(677)

2013年(807)

2012年(1241)

2011年(67)

2010年(7)

2009年(36)

2008年(28)

分类: 系统运维

2014-02-08 16:40:56

在winserver上明明已经安装了JDK1.6并设置好了JAVA_HOME,可偏偏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;提示找不到java_home各jre_home路径,何解?

原因不知道了,下面来看解决办法:

1、分析startup.bat启动脚本:发现其调用了catalina.bat,而catalina.bat调用了setclasspath.bat

2、在setclasspath.bat的头部定义了JAVA_HOMEJRE_HOME的值,那么在这里手动设置JAVA_HOME变量

@echo off
rem Licensed to the Apache Software Foundation (ASF) under one or more
rem contributor license agreements.  See the NOTICE file distributed with
rem this work for additional information regarding copyright ownership.
rem The ASF licenses this file to You under the Apache License, Version 2.0
rem (the "License"); you may not use this file except in compliance with
rem the License.  You may obtain a copy of the License at
rem
rem    
rem
rem Unless required by applicable law or agreed to in writing, software
rem distributed under the License is distributed on an "AS IS" BASIS,
rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rem See the License for the specific language governing permissions and
rem limitations under the License.

rem ---------------------------------------------------------------------------
rem Set JAVA_HOME or JRE_HOME if not already set, ensure any provided settings
rem are valid and consistent with the selected start-up options and set up the
rem endorsed directory.
rem
rem $Id: setclasspath.bat 1202062 2011-11-15 06:50:02Z mturk $
rem ---------------------------------------------------------------------------

##注意这里添加的路径要使用自己安装的java路径

set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.6.0_10   
set JRE_HOME=C:\Program Files (x86)\Java\jdk1.6.0_10

rem Make sure prerequisite environment variables are set

rem In debug mode we need a real JDK (JAVA_HOME)
if ""%1"" == ""debug"" goto needJavaHome

rem Otherwise either JRE or JDK are fine
if not "%JRE_HOME%" == "" goto gotJreHome
if not "%JAVA_HOME%" == "" goto gotJavaHome
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

............  中间省略

goto end

:exit
exit /b 1

:end
exit /b 0



3、重启tomcat,敲入验证,问题解决。



阅读(991) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~