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

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.