Is it necessary to configure environment variables for tomcat?

Source: Internet
Author: User

Is it necessary to configure environment variables for tomcat?

I have published an article about how to install and configure Tomcat, but I have always reported errors during development projects recently. Later, I was asked by the company's experts: Who told you that Tomcat needs to be configured with environment variables?

 

As a newbie, I am not good at all! So Baidu finally found out the truth about Tomcat configuration.

 

1. After extracting Tomcat, run startup. bat in the bin directory to start Tomcat!

2. If startup. bat is not run in the bin directory, the startup will fail and startup. bat will crash!

 

This solves the problem of installing multiple Tomcat on a computer derived from it:If you want to start multiple tomcat servers at the same time, either the environment variables are not configured or all are configured.

 

Let's take a look at the source code of the startup. bat file ~

 

 

 

Ah, Haha, I don't know much about it, but I can probably see that it is

Check whether the value of CATALINA_HOME is null. If the value is null, set the current directory to the value of CATALINA_HOME;

Then, determine whether catalina. bat exists. If it does not exist, set the current directory to the value of CATALINA_HOME;

Determine whether the catalina. bat in the environment variable exists. If yes, call the "catalina. bat start" command in the bin directory ~

 

Then let's look at the source code of the catalina. bat file ~

  

Determine whether CATALINA_BASE is null and set its value to the value of CATALINA_HOME.

 

As ...... Path variable ...... I can't find it in the source code or Baidu can't find the relevant information. I didn't talk about it in the documents on the official website ...... Now I really don't know how to use it.

But in the code, I see the CLASSPATH variable

 

 

 

Here, the green font, starting with rem, is a comment. If you don't understand it, copy it to google Translate ......

This means to determine and set the classpath variable, and then find the file based on the classpath variable.

 

 

To sum up, tomcat's environment variables are automatically matched during running. Why are we still blind ** to configure them?

 

 

Reference: http://www.cnblogs.com/heshan664754022/archive/2013/03/27/2984357.html

 

 

 

 

 

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.