Eclipse - 无法将 jar 添加到构建路径。jar 在项目的 lib 文件夹内,但不可见
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11641254/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Eclipse - cant add jar to build path. jar is inside the lib folder of project, but not visible
提问by sweet dreams
I manually copied the my sql connector jar to lib folder of my sql jdbc project. I had some old jars already in that folder and which were also easily added to build path before. Now, I forgot how i did it and i don't see that the lib folder when i try to add the jar to build path. How do it ? I want my jar to be a part of my project and not lying in some random folder.
我手动将我的 sql 连接器 jar 复制到我的 sql jdbc 项目的 lib 文件夹中。我在那个文件夹中已经有一些旧的 jars,之前也很容易添加到构建路径中。现在,我忘记了我是如何做到的,当我尝试将 jar 添加到构建路径时,我没有看到 lib 文件夹。怎么办?我希望我的 jar 成为我项目的一部分,而不是放在某个随机文件夹中。
采纳答案by Sai Ye Yan Naing Aye
Try to go Window > Preferences > Java > User Libraries and add new user library that point mysql connector.And then use this library to your project.But don't forget to delete your old mysql connector jar in your lib folder.Try this way.
尝试转到 Window > Preferences > Java > User Libraries 并添加指向 mysql 连接器的新用户库。然后将此库用于您的项目。但不要忘记删除 lib 文件夹中的旧 mysql 连接器 jar。试试这种方式.
回答by user1694733
Paste the jar directly inside eclipse using the project explorer to your desired folder and then try to "Add Jar" from Build Path->Configure Build Path->Libraries.
使用项目资源管理器将 jar 直接粘贴到 eclipse 中到您想要的文件夹,然后尝试从 Build Path->Configure Build Path->Libraries 中“添加 Jar”。
回答by meadlai
Select the project, and from its pop-up menu, select Properties. In the Properties dialog,
选择项目,然后从其弹出菜单中选择“属性”。在“属性”对话框中,
select the Java Build Path page.
选择 Java 构建路径页面。
Click the Libraries tab.
单击库选项卡。
You can now either add a JAR file which is contained in your workspace or which is somewhere else:
您现在可以添加包含在您的工作区中或其他位置的 JAR 文件:
to add a JAR file which is inside your workspace click the Add JARs button
要添加工作区中的 JAR 文件,请单击“添加 JAR”按钮
to add an external JAR file click the Add External JARs button
要添加外部 JAR 文件,请单击添加外部 JAR 按钮
In the dialog that appears, select the JAR file that you want to add. Note that you can add multiple JARs at once.
在出现的对话框中,选择要添加的 JAR 文件。请注意,您可以一次添加多个 JAR。
回答by Lenient Liu
You can remove the old jars which relates to sql connector jar, then add the jar you requeired into the build path.If your project is web project, you can bring the jar into the folder named lib under the WEB-INF.If your project is java project , you can make a folder named lib, then take some jars into it.
你可以把sql连接器jar相关的旧jar包去掉,然后把你需要的jar包加入到构建路径中。是java项目,你可以创建一个名为lib的文件夹,然后将一些jar包放入其中。
回答by Failing Coder
Did this get solved - I have exactly the same issue. I had 3 libs in project/src/lib, removed 2 of them but now want to reinstate them. I can still see the jar I didn't remove in the build path dialog but no matter what I do I can't reinstate the other two as the lib folder doesn't show.
这是否得到解决 - 我有完全相同的问题。我在 project/src/lib 中有 3 个库,删除了其中的 2 个,但现在想恢复它们。我仍然可以在构建路径对话框中看到我没有删除的 jar,但无论我做什么,我都无法恢复其他两个,因为 lib 文件夹没有显示。