1. 如果你的eclipse中没有server选项,这篇文章或许可以帮助你。

如上图所示,在开发WEB项目配置tomcat时,发现没有server服务选项时,点击help,选择install new software安装tomcat插件。

在work with中输入
kepler - http://download.eclipse.org/releases/kepler
等到搜索完成,勾选Web,XML, Java EE and OSGi Enterprise Development
点击next完成,等待漫长的安装即可

完成

2. 关于apache的安装请看这篇文章Apache Tomcat下载、安装图文教程
3. tomcat的配置
单击Window菜单,选择下方的Preferences

找到Server下的Runtime Environments

在Apache文件夹下选择安装的tomcat版本

选择tomcat安装路径,选择jre的版本-->Finish

如何让server显示在eclipse中,便于控制

在show view界面输入servers点击open

点击链接创建一个server

一般情况下这里默认就好,如果如要添加的WEB项目就点Next添加项目,暂时没有的话就点击Finish。

完成后如下图

这是后点击运行server
- 如果报这样的一个错误
The server cannot be started because one or more of the ports are invalid. Open the server editor and correct the invalid ports.
image.png
你需要双击你的tomcat server
image.png
- 如果出现这样的错误
Several ports (8005, 8080) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).
image.png
有可能是你的tomcat已经在运行中了,停掉正在运行的tomcat在这里运行就好了。
启动成功
image.png
到这里为止Tomcat在eclipse中配置已经基本完成,可以新建一个WEB项目,将项目添加到server中,开始在html中编写一句Hello World了。
网友评论