如何将 Java EE 类导入 Eclipse?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1448167/
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-09-19 14:01:44  来源:igfitidea点击:

How to import Java EE classes to Eclipse?

eclipsejakarta-ee

提问by

I already have installed Java SDK following which, I later also Downloaded Java EE which was not automatically Installed in Eclipse. How do I import the Java EE libraries in Eclipse?

我已经安装了 Java SDK,之后我还下载了 Eclipse 中没有自动安装的 Java EE。如何在 Eclipse 中导入 Java EE 库?

采纳答案by Thorbj?rn Ravn Andersen

Download and install/unpack your favorite Java EE container (for web applications use Tomcat)

下载并安装/解压您最喜欢的 Java EE 容器(对于 Web 应用程序,请使用 Tomcat)

Download and start the Java EE edition of Eclipse

下载并启动 Java EE 版本的 Eclipse

In the Server panel create a new local server corresponding to the above Java EE container.

在 Server 面板中,新建一个与上述 Java EE 容器相对应的本地服务器。

Create a new "Web -> Dynamic Web Project" using the server defined above. Set the "Servlet API level" to 2.4 or 2.5 depending on your needs.

使用上面定义的服务器创建一个新的“Web -> Dynamic Web Project”。根据您的需要将“Servlet API 级别”设置为 2.4 或 2.5。

The new project will have access to the appropriate Java EE libraries.

新项目将有权访问相应的 Java EE 库。

回答by VonC

Another solution would be to use the p2 mechanism(to rpovisioning system to update eclipse, if you are using eclipse3.5Galileo) to get WTP (Web Tool Platform) SDK.

另一种解决方案是使用p2 机制(如果您使用的是 eclipse 3.5Galileo ,则使用 rpovisioning 系统更新 eclipse )来获取WTP (Web Tool Platform) SDK

The SDK comes with JST (j2ee Standard Tools Project), extend eclipse platform with support for building multi-tier J2EE applications.

SDK 附带JST(j2ee 标准工具项目),扩展了 eclipse 平台,支持构建多层 J2EE 应用程序。

alt text

替代文字



Another (extreme) solution would be to get the J2EE edition of eclipsewhich includes all you need (you can then refer to your previous workspace -- through an eclipse.ini-- in order to retrieve exactly your projects you were working one)

另一个(极端)解决方案是获取Eclipse 的 J2EE 版本,其中包含您需要的所有内容(然后您可以参考您以前的工作区——通过eclipse.ini——以便准确地检索您正在处理的项目)

回答by Taylor Leese

I'd suggest using Mavenalong with the m2eclipseplugin. This will import all of the packages you need for you.

我建议将Mavenm2eclipse插件一起使用。这将导入您需要的所有包。