Install and configure tomcat and java Runtime Environment in win7

Source: Internet
Author: User
Tags configuration settings

1. Download and install JDK

Official Website: http://java.sun.com/javase/downloads/index.jsp

After downloading and installing the SDK, select the directory where you want to install the JDK:

For example, JDK installation directory: E: \ java

In other blog posts, we have to install JRE. JDK has been installed, so we don't need to install JRE.

 

2. Set JDK Environment Variables

Right-click "computer", click "properties", click "Advanced System settings" in the left part of the pop-up interface, select the "advanced" tab, and click "environment variables" in the lower part"

 

Create two variables, edit one, and fill in the following information respectively ,:

 

New:

Variable name: JAVA_HOME

Variable value: Your JDK installation directory \ jdk1.7.0

 

Variable name: CLASSPATH

Variable value:.; % JAVA_HOME % \ lib \ dt. jar; % JAVA_HOME % \ lib \ tools. jar; % atat_home % \ BIN

(Note that there is a. number at the beginning)

 

Edit:

Variable name: Path

Variable value: % JAVA_HOME % \ bin; % JAVA_HOME % \ jre \ bin;

(Paste the red string here to the beginning of the variable value)

 

Start to run CMD and enter java, javac, and java-version in the command line.
For example, if the following information is displayed, your Java environment variables are successfully configured.

 

3. Download Tomcat. The files downloaded from the official website are green and free of installation.Such as: apache-tomcat-7.0.26-windows-x64.zip

: Http://tomcat.apache.org/download-70.cgi

Decompress the package: E: \ apache-tomcat-7.0.26.

 

4. Set Tomcat Environment Variables

 

New:

Variable name: TOMCAT_HOME

Variable value: directory where your TOMCAT is located
E: \ apache-tomcat-7.0.26

 

Now the environment is basically set up. You can try it.

Start tomcat and run the tomcat directory/bin/startup. (Click startup. It seems like a flash, or a command line window pops up. It's not very nice. What will be done later)

In the browser, enter http: // localhost: 8080

If the page is displayed, congratulations on setting up the environment!

 

 

As we can see, there is a tomcat 7w.exe In the tomcat directory/binfolder. As the name suggests, tomcat displays the console in the window mode. When you open it 1st times, you may be prompted that the service specified by tomcat is not installed. In this case, we can solve this problem.

Open the command line Prompt window => enter the Tomcat installation directory ==> enter the bin directory ==> enter: service. bat install to operate. The tomcat directory is based on your own machine.



In this way, tomcat can display the console in the window mode. Click tomcat7w.exe.

 

 

Click start to start the tomcat service. If startup type is set to AUTOMATIC, it will start with startup, so you do not need to manually start it every time.

 

5: Tips for common tomcat configuration settings

 

1. Change port 8080 to 80, so that the http: // localhost: 8080/web Project can be directly written as: http: // localhos/web Project

Under the tomcat directory/bin/folder: edit the server. xml document,

Yes: <Connector port = "8080" protocol = "HTTP/1.1" connectionTimeout = "20000" redirectPort = "8443"/>

Change to: <Connector port = "80" protocol = "HTTP/1.1" connectionTimeout = "20000" redirectPort = "8443"/>

 

2. Configure the virtual directory of the WEB Project

Before configuration, you must create a new folder: WEB-INF in the web project folder, which must have a file for web. xml. You can copy these data directly in tomcat/webapps/ROOT/and put them in your WEB project.

If not configured, you need to put the web project folder under tomcat/webapps/, and the access path is: http: // localhost: 8080/web project folder name

If the WEB Project is placed on another drive letter, edit the server. xml file under the tomcat directory/bin/folder,

At the end of the document, add: <Context path = "/nala" docBase = "e: \ www \ nala"> </Context>,

Path indicates the access ID, and docBase indicates the directory where the actual project is located. Restart tomcat and access: http: // localhost: 8080/nala.

 

All the configurations and instructions have been completed. You can use the tomcat environment in win7.



Expected year

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.