带有jlink压缩标签的Java9打包器 [英] Java9 packager with jlink compress tags

查看:105
本文介绍了带有jlink压缩标签的Java9打包器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我们创建jlink运行时映像时,我们可以使用诸如'--strip-debug','-compress','2','-no-header-files,'-no-man-页",在45mb左右的位置创建一个分发文件夹.

when we create jlink runtime images we can use tags such as '--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages' , creating a distribution folder around 45mb.

例如,如果要使用javapackager创建.DMG文件,我们如何进行类似的压缩?因为这些标签不适用于javapackager.没有它们,最终的捆绑包大约是100mb,失去了很多java9模块化优势,所以我的问题是,是否可以将javapackager与jlink创建的JRE运行时映像一起使用.

If we want to use javapackager, for example to create an .DMG file, how can we do a similar compression? since these tags are not avaiable for javapackager. Without them the final bundle is around 100mb, losing a lot the java9 modularization advantages, so my question is if it is possible to use javapackager with JRE runtime images created by jlink.

谢谢

推荐答案

回答我自己的问题,我们可以仅使用以下两项的组合:

Answering my own question, we can just use the combination of two:

对于MacOSX示例:

For MacOSX example:

1)使用jlink生成运行时dist,如果使用compress标签,这将创建一个大约50mb的lib文件夹.

1) generate a runtime dist with jlink, this will create a lib folder with around 50mb if you use compress tags.

2)使用javapackager生成MacOSX.app,此.app将带有一个大约98mb的运行时lib文件夹.

2) Generate MacOSX.app with javapackager, this .app will come with a runtime lib folder around 98mb.

3)简单地替换它们,右键单击MacOSX.app->显示软件包内容",然后转到Plugins/Java.runtime/Contents/Home/并将lib文件夹替换为jLink生成的文件夹.

3) Simple replace them, right click MacOSX.app-> "show package contents", then go to Plugins/Java.runtime/Contents/Home/ and replace lib folder with the one generated by jLink.

这样,有了漂亮的Java9模块,您将拥有一个独立的Java应用程序,其大小约为50mb而不是100mb.

This way you have a self-contained Java app with around 50mb instead of 100mb, thanks to beautiful Java9 modules.

仅使用javapackager来完成所有这些工作就很酷,如果可能我找不到如何做的话,我建议使用gradle之类的东西通过1条命令来执行所有这些过程.

Would be cool to do all of this just with javapackager, if it's possible I couldn't find how, I suggest to use something like gradle to execute all this process with 1 command.

这篇关于带有jlink压缩标签的Java9打包器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆