Startup. bat

Source: Internet
Author: User

If "% OS %" = "windows_nt" setlocal // determine whether the current system is a Windows system

Rem --------------------------------------------------------------------------- // REM is a comment (the same below)

Rem start script for the Catalina Server

Rem

Rem $ ID: startup. Bat 302918 18: 25: 11z yoavs $

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

Rem guess catalina_home if not defined

Set current_dir = % Cd % // set the current directory

If not "% catalina_home %" = "" gotogothome // If the catalina_home environment variable is set, go directly to the following gothome

Set catalina_home = % current_dir % // If catalina_home is not set, set catalina_home to the current directory (in fact, she assumes that you enter the tomcat installation directory)

If exist "% catalina_home % \ bin \ Catalina. Bat" gotookhome // you can check whether Catalina. bat has been found. If so, go directly to the gothome section below.

CD .. // here it is assumed that you have already entered the bin directory of Tomcat, so it is returned to the directory of the previous level

Set catalina_home = % Cd % // now set catalina_home to the tomcat installation directory.

Cd % current_dir % // enter the current DoS directory

: Gothome

If exist "% catalina_home % \ bin \ Catalina. bat "gotookhome // judge Catalina again. if BAT is found, go to the okhome area below. If not, you will be prompted!

Echo the catalina_home environment variable is not defined correctly

Echo this environment variable is needed to run this program

Goto end

: Okhome

Set executable = % catalina_home % \ bin \ Catalina. Bat // set the file to be executed

Rem check that target executable exists

If exist "% executable %" gotookexec // check whether Catalina. bat is found again. If it is found, it is directed to the following okexec. If it is not found, it is prompted.

Echo cannot find % executable %

Echo this file is needed to run this program

Goto end

: Okexec

Rem get remaining unshifted command line arguments and save them in

Set pai_line_args = // here is the set Parameter

: Setargs

If "% 1" "=" gotodonesetargs // determines whether the parameter is added successfully.

Set pai_line_args = % pai_line_args % 1 // set the parameter to a row and connect it

Shift

Gotosetargs

: Donesetargs

Call "% executable %" start % cmd_line_args % // run Catalina. bat. You 'd better change this line to echo "% executable %" start % cmd_line_args % to read and understand the role of this file

: End

// This batch file is mainly used to find and execute Catalina. Bat correctly.

When we extract tomcat to a local directory, we usually set an environment variable for catalina_home. When executing this file, it is easy to find Catalina. bat.
If the environment variable catalina_home is not set, enter the tomcat installation directory or bin in DOS... sub-directory, and then execute this file. If it is in another directory, the system will prompt that the file cannot be found.

 

Modify startup. bat,Make it independent of java_homAnd catalina_homeVariable Method:

 

Set java_home = JDK directory
Set catalina_home = Tomcat directory after decompression

For example:

Set java_home = D: \ Program Files \ Java \ jdk1.6.0 _ 21

Set catalina_home = D: \ Program Files \ apache-Tomcat-6.0.29

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.