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. ASP.NET统计图表控件

    近来客户需要将前段时间开发的统计信息用图表展示出来,还要多个图表类型,例如:柱状图.饼图.曲线图.三维图等等.在网上google了一下,发现了三个(也许更多)可以使用的控件.下面我们一起看看这三个控件 ...

  2. I.MX6 u-boot 2009 lvds hdmi lcd 补丁

    /************************************************************************* * I.MX6 u-boot 2009 lvds ...

  3. CodeForces-607B:Zuma (基础区间DP)

    Genos recently installed the game Zuma on his phone. In Zuma there exists a line of n gemstones, the ...

  4. DPI和PPI

    写在前面 各种手机测频机构或者相关资讯老是谈及一个概念:ppi和dpi,通常总会忽略,只是稍微明白,这参数越高,说明屏幕分辨率越高:很长时间都止步如此:但作为一个iOS开发者,岂能止步如此,万一别人问 ...

  5. bzoj 4398 福慧双修 —— 二进制分组+多起点最短路

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=4398 按二进制每一位是 0/1 把 1 号点的儿子分成两组,分别作为起点和终点跑多起点最短路 ...

  6. Laravel实践-自定义全局异常处理

    在做API时,需要对一些异常进行全局处理 百牛信息技术bainiu.ltd整理发布于博客园比如添加用户执行失败时,需要返回错误信息 // 添加用户 $result = User::add($user) ...

  7. ASP.NET Core:WebAppCoreRESTful

    ylbtech-ASP.NET Core:WebAppCoreRESTFul 1.返回顶部 1. 2. 3.         4. 2. Controllers返回顶部 1.HomeControlle ...

  8. scp.sh

    #!/bin/sh #Auto change server files #liudong 2016-3-21 if [ ! -f ip.txt ];then echo -e "\033[31 ...

  9. 文件的创建,读取,写入,修改,删除---python入门

    转自:http://blog.163.com/jackylau_v/blog/static/175754040201181505158356/ 一.用Python创建一个新文件,内容是从0到9的整数, ...

  10. F - Candy Bags

    A. Candy Bags time limit per test 1 second memory limit per test 256 megabytes input standard input ...