第一种方法:
version right now but the steps work same for Eclipse Juno(4.2),
Indigo(3.7), Helios(3.6). If you have a version older than Helios then I
would recommend that you upgrade to Kepler since versions older than
Helios are not supported. Here are the steps to download and setup Eclipse.
Start Eclipse and open the New Project Wizard. Currently it would not contain the Web folder and the Dynamic Web Project option.
Click Cancel. In the top Menu bar click on Help -> Install New Software
With"下拉,根据你的eclipse版本名选择
Kepler版本)
OR "http://download.eclipse.org/releases/indigo"(如果你是 EclipseIndigo版本)
OR "http://download.eclipse.org/releases/helios"(如果你是 Eclipse Helios版本)
Note: If you do not see above site in the dropdown, you can add it using the add button.
展开 "Web, XML, Java EE and OSGi Enterprise Development" 选项,并且将下面四个选项打上勾:
- Eclipse Java EE Developer Tools
- Eclipse Java Web Developer Tools
- Eclipse Web Developer Tools
- Eclipse XML Editors and Tools
然后点击”Next“。
依次点击“Next ”知道你看到 “ Review licences”的窗口。在这个窗口选择 "I accept the terms of the licence agreement" 并且点击“Finish”。
eclipse会开始安装新的软件.
安装完插件之后, Eclipse会要求你重启eclipse,选择“yes”。
重启eclipse之后, 打开新建项目的面板,就可以看到 Web文件夹 和 “Dynamic
Web Project” 选项了。
在eclipse配置tomcat的时候,我发现在Eclipse---Preferences---server---Runtime Environment中,点击“Add”按钮,里面看不到tomcat的,只有个“J2EE Runtime Library”。
- Help -> Install New Software
- Choose "Luna - http://download.eclipse.org/releases/Luna" site
- Expand "Web, XML, and Java EE Development"
- Check JST Server Adapters (version 3.2.2) and JST Server Adapters Extentions
安装完后,就能在 Server Runtime Environments的Add按钮中看到tomcat的选项了。
EDIT: With Eclipse 3.7 Indigo Classic, Eclipse Kepler and Luna, the
steps are the same (with appropriate update site) but you need both JST Server Adapters and JST Server Adapters Extentions to get the Server Runtime Environment options.