如何将 .jar 添加到 Eclipse 中的构建路径?

发布于 2024-08-30 12:50:25 字数 362 浏览 4 评论 0原文

我尝试按以下方式执行此操作:

  1. 右键单击项目名称。

  2. 单击下拉菜单中的“构建路径”。

  3. 单击“配置构建路径”

然后我不知道该怎么办。我应该选择“来源”、“项目”、“库”、“订购和导出”吗?

在“库”中,我有“添加 JAR...”和“添加外部 JAR...”。我应该选择什么? (我的项目的 lib 文件夹中已经有一个 .jar 文件。)

添加:

如果我单击“库”选项卡中的“添加 JAR”,我会看到“lib”子文件夹但如果我去那里,我在那里看不到我的 .jar 文件(而且我知道它在那里)。

I try to do it the following way:

  1. Right click on the name of the project.

  2. Click on Build Path in the drop dawn menu.

  3. Click on "Configure Build Path"

And then I do not know what to do. Should I select "Source", "Projects", "Libraries", "Order and Export"?

In "Libraries" I have "Add JARs..." and "Add External JARs...". What should I select? (I have already a .jar file in the lib folder of my project.)

ADDED:

If I click on "Add JARs" in the "Libraries" tab, I see the "lib" sub-folder but if I go there I do not see my .jar file there (and I know that it is there).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

帅气称霸 2024-09-06 12:50:25
  1. 右键单击要添加的 jar。
  2. 构建路径 > 添加到构建路径

你就完成了。

如果您想使用 Java Build Path 视图添加库,正如您尝试的那样,您必须使用Add JARs。如果您通过文件系统复制库,则项目不同步。您可以在所选项目上按F5

如果您经常在 Eclipse 外部进行编辑,则可以通过转到 Window > 来启用自动刷新。 “首选项”菜单,然后在“首选项”对话框中选择“常规”>“首选项”。工作区
选中自动刷新框。

  1. Right click on the jar you want to add.
  2. Build Path > Add to Build Path

You're done.

If you want to add the Library with the Java Build Path view, as you tried you have to use Add JARs. If you copied the library via File System the Project is not in sync. You could press F5 on the selected Project.

If you edit outside of Eclipse a lot, you can enable auto-refresh by going to Window > Preferences menu, then in the Preferences dialog box, select General > Workspace.
Check the Refresh automatically box.

爱人如己 2024-09-06 12:50:25

我认为您将 jar 文件添加到选定项目中几乎是正确的,

右键单击项目名称。

单击菜单中的属性。

单击“Java Build Path”

然后选择“Libraries”

在“Libraries”中单击“AddExternal JARs...”。(如果jar文件存在于项目外部)
否则,单击“添加 Jars”(如果项目中存在 jar)

一旦执行此操作,工作区就会自动构建,之后您的应用程序将被设置为用于开发。

I think you are almost correct in adding the jar files to the Selected Project

Right click on the name of the project.

Click on Properties in the menu.

Click on "Java Build Path"

Then select "Libraries"

In "Libraries" Click "Add External JARs...".(if the jar files exists outside the project)
Else Click "Add Jars" (if the jars Exists within the project)

Once you do this, workspace builds automatically and after that your application is set to use for the development.

乞讨 2024-09-06 12:50:25

单击“添加 Jar”并从项目路径中选择 jar。

Click "Add Jar" and select the jar from your project path.

Hello爱情风 2024-09-06 12:50:25

如果该 jar 已位于您的项目目录中,请单击“库”选项卡中的“添加 jar”。如果没有,请单击“添加外部 jar”。
应该可以做到这一点。

如果您的 jar 在您单击“添加 jar”时没有显示,尽管您已将其复制到项目目录,您应该刷新您的项目。只需转到 Eclipse 中的项目资源管理器,右键单击项目名称,然后单击“刷新”。

If the jar is already in you project directory click "Add jar" in the Libraries-tab. If not click "Add external jar".
That should do it.

If your jar does not show up when you click "Add jar" although you have copied it to your project directory you should refresh your project. Just go to your project explorer in eclipse, right click on the project-name and click "Refresh".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文