Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1618970
  • 博文数量: 104
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 4631
  • 用 户 组: 普通用户
  • 注册时间: 2013-09-11 10:57
个人简介

欢迎关注:https://zhangdd.com

文章分类

全部博文(104)

文章存档

2018年(9)

2016年(4)

2015年(23)

2014年(54)

2013年(14)

分类: 系统运维

2014-02-07 15:49:50

在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,敲入验证,问题解决。



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