Tomcat启动时一闪而过,但是jdk环境变量配置正确,并使用java或者javac命令多可以运行,但是tomcat不能运行解决办法。
2013-09-21 11:40
1186 查看
今天在使用tomcat6.0.7时出现Tomcat启动时一闪而过,但是jdk环境变量配置正确,并使用java或者javac命令多可以运行,但是tomcat不能运行解决办法。
1.在命令行中直接启动tomcat时查看错误信息 如;
C:\Users\Administrator>
C:\Users\Administrator>cd D:\apache-tomcat-6.0.37\bin
C:\Users\Administrator>d:
D:\apache-tomcat-6.0.37\bin>startup.bat
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
D:\apache-tomcat-6.0.37\bin>
D:\apache-tomcat-6.0.37\bin>
2.根据以上信息,配置java_home路径:如java_home="D:\Program Files\java\jdk1.6.0_21\bin"
配置jre路径: jre_home="D:\Program Files\java\jdk1.6.0_21\jre"
3.重新启动tomcat。
4.如果以上配置完成还是不能启动,请看下面配置.
5.由于tomcat的startup.bat启动时,调用的是catalina.bat ,而catalina.bat调用了setclasspath.bat
在setclasspath.bat中配置的就是tomcat运行时所需的jar包及使用所需的类。
在setclasspath.bat的头部配置JAVA_HOME和JRE_HOME的值。如下:
set JAVA_HOME=D:\Program Files\java\jdk1.6.0_21
set JRE_HOME=D:\Program Files\java\jdk1.6.0_21\jre
6.配置完成再次启动tomcat即可。
setclasspath.bat文件如下:
@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 CLASSPATH and Java options
rem
rem $Id: setclasspath.bat 908749 2010-02-10 23:26:42Z markt $
rem ---------------------------------------------------------------------------
set JAVA_HOME=D:\Program Files\java\jdk1.6.0_21
set JRE_HOME=D:\Program Files\java\jdk1.6.0_21\jre
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJdkHome
if not "%JRE_HOME%" == "" goto gotJreHome
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
:gotJreHome
if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome
if not ""%1"" == ""debug"" goto okJavaHome
echo JAVA_HOME should point to a JDK in order to run in debug mode.
goto exit
:gotJdkHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%"
goto okJavaHome
:noJavaHome
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
goto exit
:okJavaHome
if not "%BASEDIR%" == "" goto gotBasedir
echo The BASEDIR environment variable is not defined
echo This environment variable is needed to run this program
goto exit
:gotBasedir
if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir
echo The BASEDIR environment variable is not defined correctly
echo This environment variable is needed to run this program
goto exit
:okBasedir
rem Don't override the endorsed dir if the user has set it previously
if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir
rem Set the default -Djava.endorsed.dirs argument
set "JAVA_ENDORSED_DIRS=%BASEDIR%\endorsed"
:gotEndorseddir
rem Set standard command for invoking Java.
rem Note that NT requires a window name argument when using start.
rem Also note the quoting as JAVA_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java"
set _RUNJDB="%JAVA_HOME%\bin\jdb"
goto end
:exit
exit /b 1
:end
exit /b 0
1.在命令行中直接启动tomcat时查看错误信息 如;
C:\Users\Administrator>
C:\Users\Administrator>cd D:\apache-tomcat-6.0.37\bin
C:\Users\Administrator>d:
D:\apache-tomcat-6.0.37\bin>startup.bat
The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE
D:\apache-tomcat-6.0.37\bin>
D:\apache-tomcat-6.0.37\bin>
2.根据以上信息,配置java_home路径:如java_home="D:\Program Files\java\jdk1.6.0_21\bin"
配置jre路径: jre_home="D:\Program Files\java\jdk1.6.0_21\jre"
3.重新启动tomcat。
4.如果以上配置完成还是不能启动,请看下面配置.
5.由于tomcat的startup.bat启动时,调用的是catalina.bat ,而catalina.bat调用了setclasspath.bat
在setclasspath.bat中配置的就是tomcat运行时所需的jar包及使用所需的类。
在setclasspath.bat的头部配置JAVA_HOME和JRE_HOME的值。如下:
set JAVA_HOME=D:\Program Files\java\jdk1.6.0_21
set JRE_HOME=D:\Program Files\java\jdk1.6.0_21\jre
6.配置完成再次启动tomcat即可。
setclasspath.bat文件如下:
@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 CLASSPATH and Java options
rem
rem $Id: setclasspath.bat 908749 2010-02-10 23:26:42Z markt $
rem ---------------------------------------------------------------------------
set JAVA_HOME=D:\Program Files\java\jdk1.6.0_21
set JRE_HOME=D:\Program Files\java\jdk1.6.0_21\jre
rem Make sure prerequisite environment variables are set
if not "%JAVA_HOME%" == "" goto gotJdkHome
if not "%JRE_HOME%" == "" goto gotJreHome
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
:gotJreHome
if not exist "%JRE_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JRE_HOME%\bin\javaw.exe" goto noJavaHome
if not ""%1"" == ""debug"" goto okJavaHome
echo JAVA_HOME should point to a JDK in order to run in debug mode.
goto exit
:gotJdkHome
if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javaw.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\jdb.exe" goto noJavaHome
if not exist "%JAVA_HOME%\bin\javac.exe" goto noJavaHome
if not "%JRE_HOME%" == "" goto okJavaHome
set "JRE_HOME=%JAVA_HOME%"
goto okJavaHome
:noJavaHome
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
goto exit
:okJavaHome
if not "%BASEDIR%" == "" goto gotBasedir
echo The BASEDIR environment variable is not defined
echo This environment variable is needed to run this program
goto exit
:gotBasedir
if exist "%BASEDIR%\bin\setclasspath.bat" goto okBasedir
echo The BASEDIR environment variable is not defined correctly
echo This environment variable is needed to run this program
goto exit
:okBasedir
rem Don't override the endorsed dir if the user has set it previously
if not "%JAVA_ENDORSED_DIRS%" == "" goto gotEndorseddir
rem Set the default -Djava.endorsed.dirs argument
set "JAVA_ENDORSED_DIRS=%BASEDIR%\endorsed"
:gotEndorseddir
rem Set standard command for invoking Java.
rem Note that NT requires a window name argument when using start.
rem Also note the quoting as JAVA_HOME may contain spaces.
set _RUNJAVA="%JRE_HOME%\bin\java"
set _RUNJDB="%JAVA_HOME%\bin\jdb"
goto end
:exit
exit /b 1
:end
exit /b 0
相关文章推荐
- java环境配置正确,但是tomcat不能启动的解决办法
- 安装完exe版本jdk之后未配置java_home和path环境变量仍然可以在cmd中使用java命令原因解释
- java环境变量path也配置了,但还是显示javac不是内部或外部命令的解决办法
- JAVA开发中遇到的jdk配置正确但是tomcat服务器启动时一闪而过
- 关于Java为什么配置好环境变量但是不能在命令行cmd运行javac的问题
- tomcat启动报错后设置环境变量配置的为jdk1.7 但是用java -version查看版本却是1.8的解决方法
- Windows 7下配置JDK环境变量,JAVA环境变量配置,Tomcat服务器的使用
- java配置环境变量问题,环境变量都正确了,但是JAVA_HOME不能识别,导致javac java -version不出现
- win10配置java环境变量,解决javac不是内部或外部命令等问题
- JDK 环境变量已经配置好,但是启动MyEclipse 2014还是报无JDK或JRE运行环境问题
- windows 10 配置jdk环境变量遇到 javac或者jar 不是内部或外部命令问题
- 【坑】当java的环境变量配置正确还是不能运行eclipse的情况
- JDK和TOMCAT环境变量配置及解决tomcat启动时一闪即逝问题
- Tomcat 启动startup.bat一闪而过问题【JDK的环境变量配置】
- win10配置java环境变量,解决javac不是内部或外部命令等问题
- win10配置java环境变量,解决javac不是内部或外部命令等问题
- 关于jdk环境变量配置成了1.6.0_39 32位jdk 的路径 cmd中java -version却还是显示 64位或者其他jdk 路径的解决方法
- 关于系统默认JDK1.8, 但是使用Maven 的mvn -version命令时发现Java版本为其他解决办法
- win10配置java环境变量,解决javac不是内部或外部命令等问题
- JDK安装成功了,环境变量也配置好了,测试代码也可以运行,但是打不开eclipse