Java 如何在 Eclipse 中添加库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2759168/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 12:31:53  来源:igfitidea点击:

How do I add a library in Eclipse?

javaeclipseinstall

提问by jul

I downloaded the Gson library from http://code.google.com/p/google-gson/. The archive contains the following jar files:

我从http://code.google.com/p/google-gson/下载了 Gson 库。存档包含以下 jar 文件:

google-gson-1.3/gson-1.3-javadoc.jar
google-gson-1.3/gson-1.3.jar
google-gson-1.3/gson-1.3-sources.jar

google-gson-1.3/gson-1.3-javadoc.jar
google-gson-1.3/gson-1.3.jar
google-gson-1.3/gson-1.3-sources.jar

How do I set my Eclipse to be able to use the package in my projects? Where do I put the documentation?

如何设置我的 Eclipse 以便能够在我的项目中使用该包?我把文档放在哪里?

采纳答案by bakkal

Right Click on the project, Build Path->Add External Archives

右键单击项目,构建路径->添加外部档案

回答by Soghra Gargari

Here is the youtube link which answers this question. it shows how to step by step add gson to Java. https://www.youtube.com/watch?v=fzdIcbnnwSA

这是回答这个问题的youtube链接。它展示了如何逐步将 gson 添加到 Java。https://www.youtube.com/watch?v=fzdIcbnnwSA

1)Add google-gson-1.3/gson-1.3.jar as external library

1)添加google-gson-1.3/gson-1.3.jar作为外部库

2) click on the new added library and add google-gson-1.3/gson-1.3-sources.jar to source attachment

2)点击新添加的库并将google-gson-1.3/gson-1.3-sources.jar添加到源附件

3) click on the new added library and add javadoc google-gson-1.3/gson-1.3-javadoc.jar to javadoc location.

3) 单击新添加的库并将 javadoc google-gson-1.3/gson-1.3-javadoc.jar 添加到 javadoc 位置。