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. Excel: 使用Countif函数来去掉Excel中重复的数据

    如果使用Ruby脚本,uniq函数就能搞定一切.不过我们现在还是讨论怎么用excel的Countif函数吧. 假设Excel中有一列数据:

  2. Watir: Watir-WebDriver对富文本编辑器的定位于Watir是不一致的。

    Watir对富文本编辑,一般可以采用b.frame().document.body.innerText = "Value you want to insert"但是Watir-We ...

  3. linux中使用netstat

    1 功能: 显示本机的网络连接.运行端口和路由表的信息. 2 常见选项 -a:显示本机所有连接和监听的端口 -n:网络IP地址的形式显示当前建立的有效连接和端口 -r:显示路由表信息 -s:显示按协议 ...

  4. Cardboard对像的公共方法与属性

    一.  public Pose3D EyePose(Eye eye)/// The transformation from head to eye. 获取眼睛在头部坐标系中的局部transform: ...

  5. 用script标签加载

    此文已由作者杨帆授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 注:经过更深入的测试,实在不好意思,这篇文章是有问题的 更改script的type属性 并不能通过src来加载 ...

  6. IT兄弟连 JavaWeb教程 URI、URL

    URI介绍 URI(Uniform Resource Identifier),是统一资源标识符的缩写,是一个用于标识某一个Web资源名称的字符串,该标识允许用户对任何资源通过特定的协议进行交互.Web ...

  7. 笔记:JavaScript闭包

    闭包 闭包是一种保护私有变量的机制,在函数执行时形成私有的作用域,保护里面的私有变量不受外界干扰.直观的说就是形成一个不销毁的栈环境. 对于闭包,当外部函数返回之后,内部函数依然可以访问外部函数的变量 ...

  8. 【POJ - 2664】Prerequisites? (排序+查找)

    Prerequisites? 原文是English,这里直接就写中文吧 题意简述 k:已经选择的科目数:m:选择的科目类别:c:能够选择的科目数.r:要求最少选择的科目数量 在输入的k和m以下的一行是 ...

  9. LuoguP1268树的重量【构造/思维】By cellur925

    题目传送门 Description 给你一个矩阵$M$,$M(i,j)$表示$i$到$j$的最短距离.定义树的重量为树上各边权之和,对于任意给出的合法矩阵$M$,已知它所能表示树的重量是唯一确定的.给 ...

  10. poj 1723 Soldiers【中位数】By cellur925

    题目传送门 题目大意:平面上有n个士兵,给出每个士兵的坐标,求出使这些士兵站好所需要的最少移动步数.站好要求:所有士兵y相等,x相邻.即达到 (x,y), (x+1, y), (x+2,y)……的状态 ...