简体   繁体   English

Eclipse:将jars文件夹添加到lib

[英]Eclipse: Adding a jars folder to lib

I was trying to add a directory full of jars to the lib folder in my dynamic web project in eclipse. 我试图在Eclipse动态Web项目的lib文件夹中添加一个充满jars的目录。 I am adding a directory because I want to maintain the new jars separate from the existing ones. 我要添加目录,因为我想将新的jar与现有的jar分开维护。

I added the new jars to the class path by selecting and adding all of them to the build path. 我通过选择所有jar并将其添加到构建路径中来将其添加到类路径中。 When I run the web-application, I get class not found for the classes residing in the new jars directory. 当我运行Web应用程序时,找不到位于新jars目录中的类的类。

However, the same procedure when implemented in a plain Java project works just fine. 但是,在纯Java项目中实施相同的过程也可以。 What am I doing wrong? 我究竟做错了什么?

Thanks 谢谢

EDIT - 1: This has something to do with Deployment Assembly, I guess. 编辑-1:我想这与Deployment Assembly有关。 I added the jar path in that and it worked. 我在其中添加了jar路径,并且它起作用了。 Now, trying to apply for the complete directory. 现在,尝试申请完整目录。

Reconfigure your build path. 重新配置您的构建路径。 Remove web libraries and add web libraries again. 删除Web库,然后再次添加Web库。

I found the solution. 我找到了解决方案。 When you deploy an application on tomcat (through eclipse or otherwise), all the jars have to be present in the lib folder. 当您在Tomcat上部署应用程序时(通过eclipse或其他方式),所有jar文件都必须存在于lib文件夹中。 If you are using a separate directory for some jars then you need to add an entry in the Deployment Assembly of your project to copy the jars in the lib folder. 如果对某些jar使用单独的目录,则需要在项目的Deployment Assembly中添加一个条目,以将jar复制到lib文件夹中。 So, when you will actually run the application, the directory jars will be copied to lib. 因此,当您实际运行应用程序时,目录jar将被复制到lib。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM