本文介绍了将文件夹添加到Eclipse类路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在开发Java项目时,我将所有的jar文件放在我的项目中创建的文件夹中,名为 libs。现在,有没有办法添加我的 libs 文件夹到Java类路径,以便我不必添加每个单独的jar?

While developing a Java project, I place all of my jar files in a folder, created within my project, called 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?

我在想一些沿着变量或创建用户库的东西。

I was thinking something along the lines of a variable or creating a user library.

推荐答案

根据你所说的话,我可能会创建一个包含您的库JAR的用户库。

Based on what you've said, I would probably create a user library containing your library JARs.

您可以使用Window => Preferences创建一个用户库,向下钻取到Java => Build Path =>用户库。 =>然后选择新建,给你的库一个name =>然后添加你想要的JAR。

You can create a User Library with Window => Preferences, drill down to Java => Build Path => User Libraries. => Then choose New, and give your library a name => Then add the JARs you want.

然后你可以将所有的JAR添加到任何项目的类路径通过右键单击project => Add Libraries =>用户库并选择您的库。

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.

更新;要使Eclipse动态地将.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. Follow these instructions and you're in business.

这篇关于将文件夹添加到Eclipse类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-31 03:48