tec
tec

Reputation: 1149

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?

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

I read Launch4j docs, it sais jar tag is optional. 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.)

Edit 1:

This SO post is related to my question. Launch4j does not have this functionality yet.

Solution (until no other tool is capable to do so):

Note: I needed the 7zS2.sfx (27kb) version file, which I've found here by reference of this SO post. Other versions didn't make the job for me.

Upvotes: 5

Views: 1479

Answers (1)

Holger
Holger

Reputation: 298579

As far as I know, none of the exe building tools predating the Java modules has caught up yet.

In case of Launch4j, there’s a feature request, but there is no visible progress report. 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.

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. Which is the best we can get so far, until better solutions arrive.

Upvotes: 3

Related Questions