Neither the java_home or the jre_home environmental variable is defined

Source: Internet
Author: User

Starting startup. bat from the bin directory of Tomcat results in a flash of Tomcat, leaving a gorgeous figure. Why? Let's first look at Tomcat's startup. bat, which calls Catalina. bat, While Catalina. Bat calls setclasspath. bat. You only need to declare the environment variables at the beginning of setclasspath. bat. For example, my environment variables are:

Let's talk about a tomcat problem first. When you see a startup. bat in the bin, execute the command. The result is displayed.

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

 

The reason is that the environment variables java_home and jre_home will not be automatically registered after later versions are installed.

Let's first look at Tomcat's startup. bat, which calls Catalina. bat, While Catalina. Bat calls setclasspath. bat. You only need to declare the environment variable at the beginning of setclasspath. BAT (two rows in red). For example, mine is:

You only need to declare the environment variables at the beginning of setclasspath. bat. For example, my environment variables are:

Rem ---------------------------------------------------------------------------

Rem set classpath and Java options

Rem

Rem $ ID: setclasspath. Bat 505241 10: 22: 58z jfclere $

Rem ---------------------------------------------------------------------------

Set java_home = c: \ Program Files \ Java \ jdk1.6.0 _ 20

Set jre_home = c: \ Program Files \ Java \ jre6

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

......

In this way, java_home and jre_home are automatically registered every time you run startup. bat.

Run startup. bat and the message "message: server startup in XXXXX ms" is displayed.

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.