Eclipse Indigo (EE) + Java EE 6.“javax.*”中的类在哪里?
我刚刚安装了 Sun 的 Eclipse Indigo for EE 和 Java EE 6 SDK/JRE。我需要所有这些来使用“javax.*”类编译第 3 方 Java 项目。我不明白如何到达这些班级?
如何导入或以其他方式连接到 Eclipse 内的“javax.*”类?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它们位于 Java EE 实现中。换句话说,它们位于应用程序服务器中。例如,Glassfish、JBoss AS、Tomcat 等。
在 Eclipse 中,只需将目标服务器集成到 Servers 视图中,并将动态 Web 项目与其关联即可。您可以在动态 Web 项目创建向导期间选择它:
或之后通过目标运行时 在项目属性中:
一旦将项目与应用程序服务器关联起来,Eclipse 将执行所有必要的操作来使这些课程可用在编译时。要验证它,关联的服务器应在项目的“构建路径”属性中列为“库”:
再次注意,您不需要更改/摆弄其中的任何内容!如果您在黑暗中拍摄时事先进行了一些尝试以“解决”此问题,那么您应该确保已全部撤消,否则事情可能仍然会出错。
另请参阅:
They're in the Java EE implementation. In other words, they're in the application server. For example, Glassfish, JBoss AS, Tomcat, etc.
In Eclipse, just integrate the target server in Servers view and associate the dynamic web project with it. You can select it during dynamic web project creation wizard:
or afterwards via Targeted Runtimes in project's properties:
Once associated the project with the application server, Eclipse will do all the necessary magic to make those classes available during compiletime. To verify it, the associated server should be listed as Library in project's Build Path property:
Note once again, you don't need to change/fiddle anything in there! If you did some attempts beforehand while shooting in the dark in order to "fix" this problem, then you should make sure that you've undone it all, or things may still go wrong.
See also:
确保您已设置首选项中的所有设置。转到“窗口”-> “首选项”,然后检查“已安装的 JRE”,将其指向下载的 jdk 中最新且最好的 jre。如果这不起作用,请再次下载jdk和eclipse Java EE并从头开始。还要确保您已将 java 和 javac 添加到您的 PATH 中(在 Linux 或 Windows 上)
Make sure you have all the settings in preferences set. Go to 'Window' -> 'Preferences' and then check the 'Installed JREs', point it to your newest and greatest jre within downloaded jdk. If that doesn't work, download jdk and eclipse Java EE again and start from scratch. Also make sure you have a java and javac added to your PATH (either on Linux or Windows)