如何在Eclipse中导入一个jar ?
当前回答
右键单击项目。 单击Build Path。 单击“配置生成路径”。 在Libraries下面,单击Add Jar或Add External Jar。
其他回答
只是对将jar导入Eclipse(插件开发)项目的注释:
In case you are developing Eclipse plug-ins, it makes sense to use Eclipse's native bundling mechanism instead of just importing the jar into a plug-in project. Eclipse (or better its underlying OSGi runtime, Equinox) uses so-called bundles which contain some more information than plain jars (e.g., version infos, dependencies to other bundles, exported packages; see the MANIFEST.MF file). Because of this information, OSGi bundles can be dynamically loaded/unloaded and there is automatic dependency resolution available in an OSGi/Eclipse runtime. Hence, using OSGi bundles instead of plain jars (contained inside another OSGi bundle) has some advantages.
(顺便说一句:Eclipse插件与OSGi包是一回事。)
很有可能有人已经将某个(第三方)库绑定为OSGi包。你可能想看看下面的bundle仓库:
http://www.springsource.com/repository/app/ http://download.eclipse.org/tools/orbit/downloads/ http://www.osgi.org/Repository/HomePage
系统路径下的Jar文件为:
C: \ oraclexe app \ oracle产品10。2。0 \ server \ jdbc lib \ ojdbc14。jar
Ojdbc14.jar (jar文件)
要在Eclipse IDE中导入jar文件,请遵循以下步骤。
右键单击项目 选择生成路径 单击Configure Build Path 单击Libraries,选择Modulepath,然后选择Add External jar 从所需的文件夹中选择jar文件 单击“应用”和“确定”
两个选择:
1/来自项目:
2/如果你已经导入了其他jar,从“References Libraries”目录:
两者都会引导你进入这个屏幕,在这里你可以管理你的库:
Eclipse ->首选项-> Java ->构建路径->用户库->新建(命名它)->添加外部jar
(我建议在这些步骤之前将您的新库拖到eclipse文件夹中,以保持所有内容在一起,这样如果您重新安装eclipse或您的操作系统,您就不需要rwlink除JDK以外的任何内容)现在选择您想要的jar文件。单击OK。
右键单击项目并选择生成路径->添加库
供参考,只是代码,然后右键单击和来源->组织导入
如果您想要更改文件系统中的项目位置,那么添加外部Jar并不明智。
最好的方法是添加jar到构建路径,这样你的项目将在导出时编译:
在项目文件夹中创建一个名为lib的文件夹。 将您需要的所有jar文件复制到此文件夹。 在eclipse中刷新您的项目。 选择所有jar文件,然后右键单击其中一个文件,选择构建路径->添加到构建路径
推荐文章
- 在流中使用Java 8 foreach循环移动到下一项
- 访问限制:'Application'类型不是API(必需库rt.jar的限制)
- 用Java计算两个日期之间的天数
- 如何配置slf4j-simple
- 在Jar文件中运行类
- 带参数的可运行?
- 我如何得到一个字符串的前n个字符而不检查大小或出界?
- 我可以在Java中设置enum起始值吗?
- Java中的回调函数
- c#和Java中的泛型有什么不同?和模板在c++ ?
- 在Java中,流相对于循环的优势是什么?
- Jersey在未找到InjectionManagerFactory时停止工作
- 在Java流是peek真的只是调试?
- Recyclerview不调用onCreateViewHolder
- 将JSON字符串转换为HashMap