简体   繁体   English

将文件夹添加到Eclipse类路径

[英]Adding folder to Eclipse classpath

While developing a Java project, I place all of my jar files in a folder, created within my project, called libs. 在开发Java项目时,我将所有jar文件放在我的项目中创建的名为libs.的文件夹中libs. Now, is there a way to add my libs folder to the Java class path so that I do not have to add each individual jar? 现在,有没有办法将我的libs文件夹添加到Java类路径,这样我就不必添加每个jar?

I was thinking something along the lines of a variable or creating a user library. 我正在考虑变量或创建用户库的内容。

Based on what you've said, I would probably create a user library containing your library JARs. 根据您所说的,我可能会创建一个包含您的库JAR的用户库。

You can create a User Library with Window => Preferences, drill down to Java => Build Path => User Libraries. 您可以使用Window => Preferences创建用户库,深入查看Java => Build Path => User Libraries。 => Then choose New, and give your library a name => Then add the JARs you want. =>然后选择New,给你的库命名=>然后添加你想要的JAR。

Then you can add all the JARs to the classpath of any project you have by right-clicking on the project => Add Libraries => User Libraries, and selecting your library. 然后,您可以通过右键单击项目=>添加库=>用户库,然后选择库,将所有JAR添加到任何项目的类路径中。


Update; 更新; to have Eclipse dynamically add .jar files you drop into a folder to your project classpath, you need a plugin called Library Folder ClasspathContainer . 要让Eclipse动态地将.jar文件添加到项目类路径的文件夹中,您需要一个名为Library Folder ClasspathContainer的插件。 Follow these instructions and you're in business. 按照这些说明进行操作即可

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

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