Problem Description:
TOMCAT java_home or jre_home environment variable is not defined correctly
The error message is as follows:Neither the java_home nor the JRE_HOME environment variable is defined at least one of these environment VARIAB Le is needed to run this program; tip Java_home Each jre_home path is not found, Harry
The reason is not known, the following look at the solution:
1, Analysis Startup.bat startup script: found that it called the Catalina.bat, and Catalina.bat called the Setclasspath.bat
2, in Setclasspath.bat's head defines the value of java_home and jre_home , then manually set the Java_home variable here
@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 under the Apache License, Version 2.0
REM (the "License"); Except in compliance with
REM the License. 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 writing, software
REM distributed under the License is distributed on a "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 is valid and consistent with the selected start-up options and set up the
REM endorsed directory.
REM---------------------------------------------------------------------------
Set java_home = "D:\Program files\java\jdk1.7.0_71";
Set jre_home = "D:\Program files\java\jre7";
REM Make sure prerequisite environment variables is set
REM in debug mode We need a real JDK (java_home)
If ""%1 "" = = "" Debug "" Goto Needjavahome
REM Otherwise either JRE or JDK is 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 are needed to run this program
Goto exit
: Needjavahome
REM Check If we have a usable JDK
If "%java_home%" = = "goto nojavahome
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
Set "Jre_home=%java_home%"
Goto Okjava
: Nojavahome
echo the JAVA_HOME environment variable is not defined correctly.
Echo It is needed to run the This program in debug mode.
Echo Nb:java_home should point-a JDK not a JRE.
Goto exit
: Gotjavahome
REM No JRE Given, use Java_home as Jre_home
Set "Jre_home=%java_home%"
: Gotjrehome
REM Check If we have a usable JRE
If not exist "%jre_home%\bin\java.exe" goto nojrehome
If not exist "%jre_home%\bin\javaw.exe" goto nojrehome
Goto Okjava
: Nojrehome
REM Needed at least a JRE
echo the JRE_HOME environment variable is not defined correctly
echo this environment variable are needed to run
Goto exit
: Okjava
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=%catalina_home%\endorsed"
: Gotendorseddir
rem Don ' t override _runjava if the user has set it previously
If not "%_runjava%" = = "goto Gotrunjava
REM Set standard command for invoking Java.
REM Also note the quoting as jre_home may contain spaces.
Set _runjava= "%jre_home%\bin\java.exe"
: Gotrunjava
rem Don ' t override _runjdb if the user has set it previously
REM Also note the quoting as java_home may contain spaces.
If not "%_runjdb%" = = "goto gotrunjdb
Set _runjdb= "%java_home%\bin\jdb.exe"
: Gotrunjdb
Goto END
: Exit
Exit/b 1
: End
Exit/b 0
This article is from the "Lamp Little Rookie" blog, please make sure to keep this source http://lamp68.blog.51cto.com/1946204/1794561
Windows Tomcat startup error tomcat Java_home or jre_home environment variable is not defined correctly