简体   繁体   English

如何将所有引用的库导入Eclipse中的文件夹?

[英]How do I import all the referenced libraries to my folder in Eclipse?

When I pack the code in Java in JAR form, will those referenced libraries in Eclipse be packed inside also? 当我以JAR格式将代码打包为Java时,Eclipse中那些引用的库也将打包吗?

I have run into a tutorial that use import > general > file system to import JAR files instead of external JAR files. 我遇到了一个使用import> general> file system来导入JAR文件而不是外部JAR文件的教程。 Are there any differences? 有什么区别吗?

When you export a runnable jar file (using the Export wizard), there is an option to include all dependencies. 当您导出可运行的jar文件时(使用“导出”向导),可以选择包含所有依赖项。 This is not the default, and it requires some class-loading magic (which Eclipse takes care of under the hood), but if you do that, Eclipse does include all jar files your code depends on and you end up with a standalone jar file. 这不是默认值,它需要一些类加载魔术(Eclipse将在后台进行处理),但是如果您这样做,则Eclipse确实包含了代码所依赖的所有jar文件,最后得到了一个独立的jar文件。 If you create a normal jar file (runnable or not), no dependencies are included. 如果创建普通的jar文件(可运行或不可运行),则不包含任何依赖项。

Yes, you can right click on Project --> Property --> Java buildpath --> and select library tab and select "Add jar" or "Add External java " into lib folder... 是的,您可以右键单击项目->属性-> Java构建路径->并选择库选项卡,然后选择“添加jar”或“添加外部Java”到lib文件夹中...

So, it is a very good way to put all libraries into the lib folder in your project. 因此,这是将所有库放入项目中的lib文件夹的一种很好的方法。

Or you also can add a new reference library at a time when you create your new project. 或者,您也可以在创建新项目时一次添加新的参考库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM