简体   繁体   English

如何将launch4j与Java自定义运行时映像一起使用?

[英]How to use launch4j with a Java custom runtime image?

Is it possible to make a bundle/wrapper exe file with Launch4j with a modular java app? 是否可以使用带有模块化Java应用程序的Launch4j创建bundle / wrapper exe文件?

The app is modular (jmods), exported with jlink , it doesn't generate any jar, but a custom runtime image (a few folders) with a bat file that runs the command: java -m package/path.to.class 该应用程序是模块化(jmods),与出口jlink ,它不产生任何广口瓶,但一个custom runtime image (几个文件夹)与运行命令一个bat文件: java -m package/path.to.class

I read Launch4j docs , it sais jar tag is optional. 我读了Launch4j文档 ,它的sais jar标签是可选的。 Tried to use the program with the gui (it doesn't even enable the Run button) and with Windows cmd ( launch4j: Application jar doesn't exist. ) 尝试使用gui程序(它甚至不启用“运行”按钮)和Windows cmd( launch4j:应用程序jar不存在。

Edit 1: 编辑1:

This SO post is related to my question. 这篇SO帖子与我的问题有关。 Launch4j does not have this functionality yet. Launch4j还没有这个功能。

Solution (until no other tool is capable to do so): 解决方案 (直到没有其他工具能够这样做):

  • Make the 7z file with the java custon runtime image: 使用java custon运行时映像创建7z文件:

     7z a "outputPath\\fileName.7z" "inputPath\\javaCustomImgFolder" 
  • Make a config.txt file with these params: 使用这些参数创建config.txt文件

     ;!@Install@!UTF-8! Title="Your app name" //dont know where it's shown. BeginPrompt="Do you want to install This Program?" //same RunProgram="your.exe" //7z automatically search a .exe Directory="bin" //play with the path if you need to ;!@InstallEnd@! 
  • Genearte the exe file: Genearte exe文件:

     copy /b "path\\7zS2.sfx" + "path\\config.txt" + "pathTo\\fileName.7z" outputName.exe 

Note: I needed the 7zS2.sfx (27kb) version file, which I've found here by reference of this SO post . 注意:我需要7zS2.sfx(27kb)版本文件,我在这里通过参考SO帖子找到了这个文件 Other versions didn't make the job for me. 其他版本没有为我做这个工作。

As far as I know, none of the exe building tools predating the Java modules has caught up yet. 据我所知,Java模块之前的exe构建工具都没有赶上。

In case of Launch4j, there's a feature request , but there is no visible progress report. 在Launch4j的情况下,有一个功能请求 ,但没有可见的进度报告。 So we can only guess when it will be done. 所以我们只能猜测它什么时候会完成。

But since jlink can create a bundled app with launcher script, a generic generator for self extracting archive files, like WinZip or 7zip, see also How do I make a self extract and running installer , could be sufficient. 但是由于jlink可以创建一个带有启动脚本的捆绑应用程序,一个用于自解压存档文件的通用生成器,如WinZip或7zip,另请参阅如何进行自解压和运行安装程序

These generators for self-extracting archives usually also allow to specify a program/script to run after extraction, so when we archive the bundled application and specify the launch script, we get an exe file that can run a bundled modular Java application with a double-click. 这些用于自解压存档的生成器通常还允许指定在提取后运行的程序/脚本,因此当我们归档捆绑的应用程序并指定启动脚本时,我们得到一个exe文件,它可以运行带有double的捆绑模块化Java应用程序-Click。 Which is the best we can get so far, until better solutions arrive. 到目前为止,我们可以获得最好的效果,直到更好的解决方案到来。

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

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