Java 如何在 Windows XP 上安装 Tomcat?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/694513/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 18:26:09  来源:igfitidea点击:

How to install Tomcat on Windows XP?

javaapachetomcatjakarta-ee

提问by Click Upvote

I'm having trouble installing Tomcat on my windows XP machine. I already have Apache and JDK 6 installed, what I need to know is:

我在 Windows XP 机器上安装 Tomcat 时遇到问题。我已经安装了 Apache 和 JDK 6,我需要知道的是:

  • Which file to download from the Lastest Tomcat download page

  • And how to install it so I can run the sample web app by going to http://localhost/

  • 最新的 Tomcat 下载页面下载哪个文件

  • 以及如何安装它,以便我可以通过以下方式运行示例 Web 应用程序 http://localhost/

In my C:\Program Files\Javafolder, I see the following folders, this should give you an idea of whether I need any additional stuff installed:

在我的C:\Program Files\Java文件夹中,我看到以下文件夹,这应该让您知道我是否需要安装任何其他东西:

  • jdk1.6.0_10
  • jre1.6.0_04
  • jre1.6.0_06
  • jre1.6.0_07
  • jre6
  • jdk1.6.0_10
  • jre1.6.0_04
  • jre1.6.0_06
  • jre1.6.0_07
  • jre6

Thanks.

谢谢。

采纳答案by stian

Tomcat 6 doesn't really need the full JDK and it runs with Java 1.5 as well, so Java wise you should be well off. Just make sure that JAVA_HOME environment variable is set.

Tomcat 6 并不真正需要完整的 JDK,它也可以与 Java 1.5 一起运行,因此明智的 Java 应该很不错。只需确保设置了 JAVA_HOME 环境变量。

You can either get the core zip or tar.gz file, or the Windows Service installer file.

您可以获取核心 zip 或 tar.gz 文件,或者 Windows 服务安装程序文件。

Core zip file:

核心压缩文件:

http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip

http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.zip

Just unzip it and run bin/startup.bat. If you'd like to install it as a Windows service (and get the "usual" program entry in Windows add/remove programs) you can get the Windows Service Installer file instead:

只需解压缩并运行 bin/startup.bat。如果您想将其安装为 Windows 服务(并在 Windows 添加/删除程序中获取“通常的”程序条目),您可以改为获取 Windows 服务安装程序文件:

http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.exe

http://www.apache.org/dist/tomcat/tomcat-6/v6.0.18/bin/apache-tomcat-6.0.18.exe

By default tomcat listens to port 8080, so to check out the sample apps you need to go to http://localhost:8080/examples/. You can change the default port by editing server.xml in the conf directory.

默认情况下,tomcat 侦听端口 8080,因此要查看示例应用程序,您需要访问http://localhost:8080/examples/。您可以通过编辑 conf 目录中的 server.xml 来更改默认端口。

回答by kdgregory

I'm not sure what that URL is that you provided ("CGI" seems strange from a J2EE site), but the download links for tomcat are on its home page: http://tomcat.apache.org/

我不确定您提供的 URL 是什么(J2EE 站点上的“CGI”似乎很奇怪),但 tomcat 的下载链接在其主页上:http: //tomcat.apache.org/

You should probably download version 6, particularly if you're using it for personal development. The older versions are available and maintained primarily to support users who don't want to migrate J2EE versions.

您可能应该下载第 6 版,特别是如果您将它用于个人开发。旧版本的可用和维护主要是为了支持不想迁移 J2EE 版本的用户。

Finally: unless you are already using Apache, don't bother with it. Most commercial sites use Apache as a front-end because of its configurability (particularly URL rewriting). If you're just looking to develop web apps, Tomcat will act as web server in addition to servlet/JSP container.

最后:除非您已经在使用 Apache,否则不要理会它。大多数商业站点使用 Apache 作为前端,因为它具有可配置性(尤其是 URL 重写)。如果您只是想开发 Web 应用程序,除了 servlet/JSP 容器之外,Tomcat 还将充当 Web 服务器。

Installation instructions (as well as all other instructions) are here:http://tomcat.apache.org/tomcat-6.0-doc/index.html

安装说明(以及所有其他说明)在这里:http: //tomcat.apache.org/tomcat-6.0-doc/index.html

If you haven't done any J2EE development before, you'll need some docs on it. The Sun Tutorial is OK, but targeted to the Sun app-server and covers a lot of XML that isn't really necessary. Look at the intro chapters on web apps, then jump to chapter 11: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

如果您之前没有进行过任何 J2EE 开发,那么您将需要一些关于它的文档。Sun 教程还可以,但针对的是 Sun 应用程序服务器并涵盖了许多并非真正必要的 XML。查看有关 Web 应用程序的介绍章节,然后跳转到第 11 章:http: //java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

回答by marzagao

From the download page you should download the "Windows Service Installer" package.

您应该从下载页面下载“Windows 服务安装程序”包。

As for the rest of the install process, follow just "Step 3: install Tomcat" described in the following page:

至于安装过程的其余部分,请按照以下页面中描述的“步骤 3:安装 Tomcat”进行操作:

http://mircwiki.rsna.org/index.php?title=New_Installation_Instructions

http://mircwiki.rsna.org/index.php?title=New_Installation_Instructions

回答by Xonatron

Not a complete answer, but an add-on (how does Stack Overflow handle this?):

不是一个完整的答案,而是一个附加组件(Stack Overflow 如何处理这个问题?):

For a Windows (XP, Vista, 7) install, you can choose (from the options listed at http://tomcat.apache.org/download-60.cgi):

对于 Windows(XP、Vista、7)安装,您可以选择(从http://tomcat.apache.org/download-60.cgi列出的选项中):

  • .zip (pick according to your Windows version)
  • Windows Service Installer
  • .zip(根据您的 Windows 版本选择)
  • Windows 服务安装程序

Now the difference between the top two options:

现在前两个选项之间的区别:

  • .zip -- This is a manual install, where you extract the .zip and move it into whatever folder you wish. It does not install Tomcat as a service. It does not "do" anything unless you manually do something with it or have another program use it. It is a manual setup.
  • Windows Service Installer -- This is a self-installer, just run the .exe. It installs Tomcat as a Windows Service, which if you load up your Windows services (run "services.msc"), you'll see it listed as "Apache Tomcat 6.0 Tomcat6". During the install it will ask you certain setup questions like.
  • .zip -- 这是手动安装,您可以在其中解压缩 .zip 并将其移动到您希望的任何文件夹中。它不会将 Tomcat 安装为服务。它不会“做”任何事情,除非您手动用它做某事或让另一个程序使用它。这是一个手动设置。
  • Windows 服务安装程序——这是一个自安装程序,只需运行 .exe。它将 Tomcat 安装为 Windows 服务,如果您加载 Windows 服务(运行“services.msc”),您将看到它列为“Apache Tomcat 6.0 Tomcat6”。在安装过程中,它会询问您某些设置问题,例如。

If you choose "Windows Service Installer", here are the default settings the install will ask you:

如果您选择“Windows 服务安装程序”,以下是安装程序会询问您的默认设置:

  • Type of install: Normal
  • Server Shutdown Port: 8005
  • HTTP/1.1 Connector Port: 8080
  • AJP/1.3 Connector Port: 8009
  • Windows Service Name: Tomcat6
  • Create shortcuts for all users: disabled (not that this matters if it's your machine)
  • Tomcat Administration Login - User Name: blank
  • Tomcat Administration Login - Password: blank
  • Tomcat Administration Login - Roles: manager-gui
  • Path of a Java SE 5.0 or later JRE installed on your system: C:\Program Files\Java\jre7 (if you are running Java SE 7)
  • Destination (install) folder: C:\Program Files\Apache Software Foundation\Tomcat 6.0
  • 安装类型:普通
  • 服务器关闭端口:8005
  • HTTP/1.1 连接器端口:8080
  • AJP/1.3 连接器端口:8009
  • Windows 服务名称:Tomcat6
  • 为所有用户创建快捷方式:禁用(如果是你的机器,这并不重要)
  • Tomcat 管理登录 - 用户名:空白
  • Tomcat 管理登录 - 密码:空白
  • Tomcat 管理登录 - 角色:manager-gui
  • 系统上安装的 Java SE 5.0 或更高版本 JRE 的路径:C:\Program Files\Java\jre7(如果您运行的是 Java SE 7)
  • 目标(安装)文件夹:C:\Program Files\Apache Software Foundation\Tomcat 6.0

Hope this helps.

希望这可以帮助。