Linux, shutting down and restarting the Tomcat times wrong:
Neither the Java_home nor the JRE_HOME environment variable is defined
At least one of these environment variable are needed to run this program
My tomcat was normal and suddenly restarted the Tomcat times with this error, which is largely due to the unavailability of environment variables,
On the internet for a long time is said to modify the Setclasspath.bat (the file path in the Tomcat bin directory) file, add java_home and jre_home environment variables in the file,
I have also added the following in the file:
REM Make sure prerequisite environment variables is set
REM in debug mode We need a real JDK (java_home)
Export java_home=/usr/local/jdk1.7.0_79
Export JRE_HOME=${JAVA_HOME}/JRE
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
"Setclasspath.bat" [dos] 97L, 3509C
Save the file and run it again./startup.sh
Still error:
Neither the Java_home nor the JRE_HOME environment variable is defined
At least one of these environment variable are needed to run this program
Collapsed, online on a way to solve the problem;
Suddenly my consciousness flashed a thought, before using Tomcat is normal, will not be in the running memory of Linux lost Java_home and Jre_home
environment variable parameter, if so, re-write the/etc/profile environment variable is OK.
Then I ran the #source/etc/profile.
To re-write the profile configuration file
Run #java-version
There's a miracle.
Java Version "1.7.0_79"
Java (TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot (TM) 64-bit Server VM (build 24.79-b02, Mixed mode)
Switch to Tomcat's Bin directory
Run #./startup.sh
Tomcat runs successfully!
Neither the Java_home nor the JRE_HOME environment variable are defined; At least one of these environment variable is need Ed to run the program