前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >windows系统Tomcat启动过程中找不到JAVA_HOME解决方法

windows系统Tomcat启动过程中找不到JAVA_HOME解决方法

作者头像
zhangdd
发布2018-08-01 14:40:37
6520
发布2018-08-01 14:40:37
举报
文章被收录于专栏:zhangdd.com

在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_HOME和JRE_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     http://www.apache.org/licenses/LICENSE-2.0 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,敲入http://localhost:8080验证,问题解决。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-04-08,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档