Tomcat的安装及配置我曾经使用过tomcat,并实现了一个简单的servlet程序。没想到再次安装tomcat的时候用浪费了我大半天的时间。我想有必要做个总结,否则下次不知又要花费我多少时间。

1、 Tomcat下载

Tomcat是Apache开源工程的一个项目,因此我们可以去http://tomcat.apache.org/ tomcat官网去下最新版本的tomcat。目前最新的是Tomcat7.02,但是由于tomcat与jdk版本需要匹配(一般情况是jdk1.5对应tomcat5,jdk1.6对应tomcat6),保险起见还是选用用Tomcat6 。网址:http://tomcat.apache.org/download-60.cgi 问题来了,网站上提供了多种版本的tomcat,到底哪一款适合我呢?在网站提供的README文件中给出了各个版本的介绍如下:

apache-tomcat-[version].zip or .tar.gz

Base distribution. These distributions do not include the Windows service wrapper nor the compiled APR/native library for Windows.

apache-tomcat-[version].exe

32-bit/64-bit Windows installer for Tomcat. Please note that while this distribution includes the vast majority of the base distribution, some of the command-line scripts for launching Tomcat are not included. This distribution is intended for those users planning to launch Tomcat through the Windows shortcuts or services.

apache-tomcat-[version]-windows-x86.zip

32-bit Windows specific distribution that includes the Windows service wrapper and the compiled APR/native library for use with 32-bit JVMs on both 32 and 64 bit Windows platforms.

apache-tomcat-[version]-windows-x64.zip

64-bit Windows specific distribution that includes the Windows service wrapper and the compiled APR/native library for use with 64-bit JVMs on x64 Windows platforms.

apache-tomcat-[version]-windows-i64.zip

64-bit Windows specific distribution that includes the Windows service wrapper and the compiled APR/native library for use with 64-bit JVMs on Itanium 64-bit Windows platforms.

apache-tomcat-[version]-deployer.zip or .tar.gz

The standalone Tomcat Web Application Deployer. apache-tomcat-[version]-fulldocs.tar.gz The Tomcat documentation bundle, including complete javadocs.

一般情况我们选择apache-tomcat-[version]-windows-x86.zip 下载后直接解压至指定目录即可(我选择了C:\tomcat) 。当然我们只关心binary distributions就可以了,至于code版就看你个人学习激情了。

2、 tomcat 环境配置

配置Tomcat的环境变量:在“我的电脑”上点右键—>“属性”—>“高级”—> “环境变量(N)”。

1、新建系统变量CATALINA_HOME:C:\Tomcat(注意此后不要加分号)

2、新建系统变量TOMCAT_HOME:C:\Tomcat(好像是为了MyEclipse配置的)

3.在系统变量CLASSPATH的值的后面加入:CATALINA_HOME%\lib;(这个要加分号)

4、在系统变量Path的值的后面加入以下内容:CATALINA_HOME%\bin;f\方便用户运行tomcat的各种脚本:

5、在系统变量CLASSPATH的值的加入: CATALINA_HOME%\lib\servlet-api.jar;

3、 运行tomcat  直接运行startup.bat


个人建议用命令提示符程序(cmd.exe)运行C:\Tomcat\bin目录下的批处理文件(.bat)。如:注意要在当前目录下运行否则找不到 C:\Tomcat\bin> startup.bat install C:\Tomcat\bin> shutdown.bat install C:\Tomcat\bin> service.bat install 开启tomcat后可以用浏览器访问http://localhost:8080/ 如果出现tomcat的界面就说明你已经成功安装tomcat。

4、 tomcat账户设置

如果你选择的是exe安装文件,在安装过程中他会提示你输入用户名密码。

如果你用的是解压包形式的,则需要在CATALINA_HOME/conf/tomcat-users.xml文件中。编辑这个文件,可以修改用户名和密码,例如添加一个名叫“tomcat”的“manager”角色到该文件中:然后重新启动Tomcat。 登录时输入tomcat,密码tomcat即可。注意:rolename 只能是manager

5、 win7下tomcat6w.exe无法运行:

在windows7操作系统下,安装了tomcat6。双击tomcat6w.exe时,提示错误“Unable to open the service ‘tomcat6’”。解决方法一:此问题可能是windows 7的安全控制限制所致。在tomcat6w.exe文件上点击右键--属性--兼容性,勾选“以管理员身份运行此程序”,点击确定。然后双击运行即可;如果还不行见方法二。解决方法二:可能是没有安装此项服务。具体安装方法:打开命令行提示符窗口 => 进入Tomcat安装目录==> 进入bin目录下==> 输入:service.bat install 即可。如果还是不行,目前就不知道如何解决,还希望知道的大牛们给出本质的解决方案!(可能的原因由于网络端口独占不能两个tomcat同时运行)

6、tomcat.ext 与tomcat6.ext主要区别:

tomcat6.exe与tomcat6w.exe这两个都能启动tomcat,一个是提供dos界面的启动方式,一个是可视化的界面启动方式。但是呢tomcat6w.exe并不是用来启动tomcat的,而是用来配置tomcat在windows下的系统服务的。两个不能同时启动。

7.访问俄服务器8080端口时,在地址栏一定要输入"http"的完整形式,否则浏览器可能不会使用http协议去访问该端口。

Tomcat7的安装与配置的更多相关文章

  1. CentOS-6.6下Tomcat-7.0安装与配置(Linux)

    CentOS-6.6下Tomcat-7.0安装与配置(Linux) 一.认识tomcat Tomcat是一个免费的开源的Serlvet容器,它是Apache基金会的Jakarta项目中的一个核心项目, ...

  2. ubuntu下Tomcat7的安装和配置

    和前几个软件一样,Tomcat 同样是由JAVA开发的,所以,在安装前一定要装好JDK. 大家可以到 http://tomcat.apache.org/download-70.cgi 下载最新的Tom ...

  3. Ubuntu 下 Tomcat7 的安装和配置

    tomcat下载地址:http://tomcat.apache.org/download-70.cgi 声明:下面的内容和原创笔者的博文的内容差不多,不一样的只是tomcat7的安装目录不同,我按照我 ...

  4. tomcat7的安装与配置、及Servlet部署

    一.tomcat7的下载页面 https://tomcat.apache.org/download-70.cgi 就是:32-bit Windows zip 下载得到apache-tomcat-7.0 ...

  5. Tomcat7安装及配置教程

    Apache  Tomcat7.0安装及配置教程.. Apache  Tomcat7.0官方网站链接:http://tomcat.apache.org/ apache-tomcat-7.0.73-wi ...

  6. tomcat7的安装与maven安装

    tomcat7的安装与配置: 下载tomcat7 :wget 地址 解压:tar -zxvf 文件名 编辑tomcat目录下的conf下的server.xml文件: <Connector por ...

  7. 【推荐】CentOS安装Tomcat-7.0.57+启动配置+安全配置+性能配置

    注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 在安装Tomcat之前,请确保已经安装了JDK-1.7环境,具体见<CentOS安装JDK-1.7>. ...

  8. CentOS-7.0.中安装与配置Tomcat-7的方法

    安装说明 安装环境:CentOS-7.0.1406安装方式:源码安装 软件:apache-tomcat-7.0.29.tar.gz 下载地址:http://tomcat.apache.org/down ...

  9. CentOS7.0安装与配置Tomcat-7

    解决权限不够 #chmod a+x filename 安装说明 安装环境:CentOS-7.0.1406安装方式:源码安装 软件:apache-tomcat-7.0.29.tar.gz 下载地址:ht ...

随机推荐

  1. 创建Android本地repo

    /**************************************************************************** * 创建Android本地repo * 说明 ...

  2. Ubuntu bitnami gitlab 安装

    /************************************************************************************** * Ubuntu bit ...

  3. 【CQ18阶梯赛第一场】题解

    [A-风格不统一如何写程序] 输入字符串,得到长度,对于每个字符:如果是大写,则改为:‘_’+小写:如果是‘_’则忽略‘_’,并且把后面的小写改为大写. #include<cstdio> ...

  4. 51nod1127【尺取】

    思路: 尺取,写挫了,debug了半天. #include <bits/stdc++.h> using namespace std; typedef long long LL; const ...

  5. CodeForces 13A【暴力】

    题意: 给你的一个十进制数n,计算对于2~n-1进制下的每个位相加和与数n-2的比值. 思路: n是1000,所以直接暴力一发? #include<cstdio> #include< ...

  6. hdoj2796

    题意: 1.在每一堆里顶部的coin的size必须大于这一堆其他的coin: 2.在每一堆里顶部的coin的size必须大于前面堆的顶部的coin: 3.在每一堆里顶部的coin的num必须大于前面堆 ...

  7. Codeforces732D Exams

    显然要二分答案,然后对于一个天数,我们来判断是否可以通过所有考试,这里就贪心来安排就好了. 首先我们希望每门课的考试时间越晚越好,然后就是先复习最早开始的考试. #include <bits/s ...

  8. Hdu 2089 不要62 (数位dp入门题目)

    题目链接: Hdu 2089 不要62 题目描述: 给一个区间 [L, R] ,问区间内不含有4和62的数字有多少个? 解题思路: 以前也做过这个题目,但是空间复杂度是n.如果数据范围太大就GG了.今 ...

  9. Travelling HDU - 3001

    Travelling HDU - 3001 方法:3进制状态压缩dp(更好的方法是预处理出每个状态数字对应的y数组,然后用刷表,时间复杂度可以少一个n) #include<cstdio> ...

  10. 洛谷 P2261 [CQOI2007]余数求和 ||整除(数论)分块

    参考:题解 令f(i)=k%i,[p]表示不大于p的最大整数f(i)=k%i=k-[k/i]*i令q=[k/i]f(i)=k-qi如果k/(i+1)=k/i=qf(i+1)=k-q(i+1)=k-qi ...