在Mac OS X上将tomcat jar / lib目录添加到eclipse类路径 [英] Add tomcat jar/lib directory to eclipse classpath on Mac OS X
问题描述
.classpath
相混淆 - 这些更改将是在我们的源代码控件中跟踪。 我尝试将 tomcat / lib
目录添加到eclipse作为 classpath变量,但是不能解决问题。
当Tomcat服务器启动时,我收到 ClassNotFoundException:HttpServletRequest
。
如何添加tomcat lib目录,以便我不修改项目类路径?
您可以安装Webtools插件(默认情况下安装在Eclipse for JavaEE Developers中),然后您将获得Tomcat运行时支持。然后你可以在你的项目中添加一个Tomcat运行时,它将自动包含Tomcat上运行的webapps的所有Tomcat jar。
-
窗口>首选项>服务器>运行环境
- 添加..
- 选择Tomcat版本
- 浏览
- 选择Java Build Path
- 添加库.. 。> Server Runtime>
选择您创建的运行时间
此过程也将修改您的 .classpath
文件,但它将以容易与其他开发人员共享的方式进行。
< img src =https://i.stack.imgur.com/NtRiH.pngalt =enter image description here>
I have a project that requires some Tomcat libs to run properly. I installed Tomcat (on Mac) which is essentially just a put-the-folder-somewhere process. I originally resolved the issue by adding the needed jar files as external jars for the project - however this messes with the project .classpath
which I can't allow - those changes would be tracked in our source control.
I've tried adding the tomcat/lib
directory to eclipse as a classpath variable but that doesn't resolve the issue.
When the tomcat server starts, I receive ClassNotFoundException: HttpServletRequest
.
How else can I add the tomcat lib directory so that I'm not modifying the project classpath?
You can install Webtools plugin (installed by default in Eclipse for JavaEE Developers) and then you will get Tomcat runtime support. Then you can add a "Tomcat Runtime" to your project and it will automatically include all Tomcat jars that are available to webapps running on Tomcat.
Window > Preferences > Server > Runtime environments
- Add..
- Select Tomcat version
- Browse to tomcat install dir
- Right click you project > Properties
- Select Java Build Path
- Add library... > Server Runtime >
select your runtime you created
This process will also modify your .classpath
file but it will do so in a way that is easy to share with other developers.
这篇关于在Mac OS X上将tomcat jar / lib目录添加到eclipse类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!