Eclipse:如何将javax.servlet包添加到项目中? [英] Eclipse: How do I add the javax.servlet package to a project?

查看:569
本文介绍了Eclipse:如何将javax.servlet包添加到项目中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Eclipse 3.6 Helios(对于Java Developers),并希望将javax.servlet包添加到我的一个项目中。
我需要配置/下载什么?

解决方案

以具体的例子阐述darioo的答案。在OS X上使用自制软件安装Tomcat 7,使用Eclipse:


  1. 右键单击项目文件夹,选择上下文菜单底部的属性。

  2. 选择Java构建路径

  3. 单击库选项卡

  4. 单击添加库... 按钮右边(大约一半)

  5. 选择服务器运行时,点击下一步

  6. 从列表中选择你的Tomcat版本

  7. 单击完成

什么?没有Tomcat版本列出,即使你已经通过homebrew安装?


  1. 切换到Java EE透视图(右上角)

  2. 在窗口菜单中选择显示视图 - >服务器

  3. 在服务器选项卡(通常在底部)右键单击并选择新建>服务器

  4. 添加在对话/向导中的homebrew tomcat安装路径(如:/usr/local/Cellar/tomcat/7.0.14/libexec)


$ b $希望帮助别人o刚刚开始一点。


I'm using Eclipse 3.6 Helios (for Java Developers) and want to add the javax.servlet package to one of my projects. What do I need to configure/download?

解决方案

To expound on darioo's answer with a concrete example. Tomcat 7 installed using homebrew on OS X, using Eclipse:

  1. Right click your project folder, select Properties at the bottom of the context menu.
  2. Select "Java Build Path"
  3. Click Libraries" tab
  4. Click "Add Library..." button on right (about halfway down)
  5. Select "Server Runtime" click "Next"
  6. Select your Tomcat version from the list
  7. Click Finish

What? No Tomcat version is listed even though you have it installed via homebrew??

  1. Switch to the Java EE perspective (top right)
  2. In the "Window" menu select "Show View" -> "Servers"
  3. In the Servers tab (typically at bottom) right click and select "New > Server"
  4. Add the path to the homebrew tomcat installation in the dialog/wizard (something like: /usr/local/Cellar/tomcat/7.0.14/libexec)

Hope that helps someone who is just getting started out a little.

这篇关于Eclipse:如何将javax.servlet包添加到项目中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆