在Mac OS X上将tomcat jar / lib目录添加到eclipse类路径 [英] Add tomcat jar/lib directory to eclipse classpath on Mac OS X

查看:571
本文介绍了在Mac OS X上将tomcat jar / lib目录添加到eclipse类路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个项目需要一些Tomcat lib才能正常运行。我安装了Tomcat(在Mac上),它基本上只是一个put-the-folder-athere进程。我最初通过将需要的jar文件添加到项目的外部jar来解决这个问题 - 但是这与我不能允许的项目 .classpath 相混淆 - 这些更改将是在我们的源代码控件中跟踪。



我尝试将 tomcat / lib 目录添加到eclipse作为 classpath变量,但是不能解决问题。



当Tomcat服务器启动时,我收到 ClassNotFoundException:HttpServletRequest



如何添加tomcat lib目录,以便我不修改项目类路径?

解决方案

您可以安装Webtools插件(默认情况下安装在Eclipse for JavaEE Developers中),然后您将获得Tomcat运行时支持。然后你可以在你的项目中添加一个Tomcat运行时,它将自动包含Tomcat上运行的webapps的所有Tomcat jar。


  1. 窗口>首选项>服务器>运行环境

  2. 添加..

  3. 选择Tomcat版本

  4. 浏览

  5. 选择Java Build Path

  6. 添加库.. 。> 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.

  1. Window > Preferences > Server > Runtime environments
  2. Add..
  3. Select Tomcat version
  4. Browse to tomcat install dir
  5. Right click you project > Properties
  6. Select Java Build Path
  7. 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屋!

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