您可以在jar文件中添加多个jar,然后启动该jar文件

时间:2021-04-24 06:27:44

I am working on a GUI application and would rather distribute just one jar as opposed to multiple ones.

我正在开发一个GUI应用程序,而不是分发一个jar而不是多个jar。

Can you control this with the manifest.

你能用清单控制吗?

4 个解决方案

#1


Merge your jars to one jar. See this thread.

将你的罐子合并到一个罐子里。看到这个帖子。

#2


Another option is to use a custom class loader such as this one:

另一种选择是使用自定义类加载器,例如:

http://one-jar.sourceforge.net/

#3


You need to be careful when doing this. If the jars you are merging have manifest files with critical information - these can get lost, only the last file will get merged.

这样做时你需要小心。如果您要合并的jar文件中包含关键信息的清单文件 - 这些文件可能会丢失,只会将最后一个文件合并。

E.g. If you merge JavaMail - the manifest file is important. If you lose it - bad things csn happen.

例如。如果合并JavaMail - 清单文件很重要。如果你失去它 - 发生了不好的事情。

The safest thing to do is to look at each jar file and check the manifest file.

最安全的做法是查看每个jar文件并检查清单文件。

#4


Have a look here. Use Netbeans 6.7.1 to combine multiple jars into 1 jar

看看这里。使用Netbeans 6.7.1将多个罐子组合成一个罐子

#1


Merge your jars to one jar. See this thread.

将你的罐子合并到一个罐子里。看到这个帖子。

#2


Another option is to use a custom class loader such as this one:

另一种选择是使用自定义类加载器,例如:

http://one-jar.sourceforge.net/

#3


You need to be careful when doing this. If the jars you are merging have manifest files with critical information - these can get lost, only the last file will get merged.

这样做时你需要小心。如果您要合并的jar文件中包含关键信息的清单文件 - 这些文件可能会丢失,只会将最后一个文件合并。

E.g. If you merge JavaMail - the manifest file is important. If you lose it - bad things csn happen.

例如。如果合并JavaMail - 清单文件很重要。如果你失去它 - 发生了不好的事情。

The safest thing to do is to look at each jar file and check the manifest file.

最安全的做法是查看每个jar文件并检查清单文件。

#4


Have a look here. Use Netbeans 6.7.1 to combine multiple jars into 1 jar

看看这里。使用Netbeans 6.7.1将多个罐子组合成一个罐子