将库提取和打包到jar文件中的区别

时间:2022-12-15 19:29:06

I would like to know the difference between extracting and packaging libraries into a jar file from eclipse with the runnable jar file creation.

我想知道使用可运行jar文件创建从eclipse提取和打包库到jar文件的区别。

If my program (runnable jar) uses other classes which require these external libraries(jars), what should I pick?

如果我的程序(runnable jar)使用其他需要这些外部库(jar)的类,我应该选择什么?

1 个解决方案

#1


39  

If you want to put jars into your generated jar file, you can use packaging method. For example if you are using an Apache library or some other 3rd party jars, you may want to keep these jars preserved in your generated jar. In this case, use packaging. "Packaging required libraries into a jar file" option puts classes of org.eclipse.jdt.internal.jarinjarloader package into your generated file and this package is just under the root directory of the generated jar file. This option also creates a larger jar file in terms of size due to jar loader classes of Eclipse.

如果要将jar文件放入生成的jar文件中,可以使用打包方法。例如,如果您正在使用Apache库或其他第三方jar,您可能希望将这些jar保存在生成的jar中。在这种情况下,使用包装。“将所需的库打包到jar文件中”选项将org. eclipsee .jdt.internal.jarinjarloader包的类放入到生成的文件中,这个包就在生成的jar文件的根目录下。这个选项还可以根据Eclipse的jar装载器类的大小创建一个更大的jar文件。

Extracting required libraries will result in putting classes of 3rd party libraries into your jar file by following the package naming convention, e.g. if you open your jar content you can see some classes under org.apache.. packages.

提取所需的库将根据包命名约定将第三方库类放入jar文件中,例如,如果打开jar内容,可以在org.apache下看到一些类。包。

Main class entries are different between the MANIFEST.MF files of these jar files:

主类条目在清单中是不同的。这些jar文件的MF文件:

Main class entry when you package required libraries:

当您打包所需的库时,请输入主类:

Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

Main class entry when you extract required libraries:

当您提取所需的库时,主类条目:

Main-Class: YourMainClass

#1


39  

If you want to put jars into your generated jar file, you can use packaging method. For example if you are using an Apache library or some other 3rd party jars, you may want to keep these jars preserved in your generated jar. In this case, use packaging. "Packaging required libraries into a jar file" option puts classes of org.eclipse.jdt.internal.jarinjarloader package into your generated file and this package is just under the root directory of the generated jar file. This option also creates a larger jar file in terms of size due to jar loader classes of Eclipse.

如果要将jar文件放入生成的jar文件中,可以使用打包方法。例如,如果您正在使用Apache库或其他第三方jar,您可能希望将这些jar保存在生成的jar中。在这种情况下,使用包装。“将所需的库打包到jar文件中”选项将org. eclipsee .jdt.internal.jarinjarloader包的类放入到生成的文件中,这个包就在生成的jar文件的根目录下。这个选项还可以根据Eclipse的jar装载器类的大小创建一个更大的jar文件。

Extracting required libraries will result in putting classes of 3rd party libraries into your jar file by following the package naming convention, e.g. if you open your jar content you can see some classes under org.apache.. packages.

提取所需的库将根据包命名约定将第三方库类放入jar文件中,例如,如果打开jar内容,可以在org.apache下看到一些类。包。

Main class entries are different between the MANIFEST.MF files of these jar files:

主类条目在清单中是不同的。这些jar文件的MF文件:

Main class entry when you package required libraries:

当您打包所需的库时,请输入主类:

Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader

Main class entry when you extract required libraries:

当您提取所需的库时,主类条目:

Main-Class: YourMainClass