I have a legacy Batch-File that starts up my application after doing some configuration. Trying to migrate to install4j i ran into the problem, that i cannot generate a launcher that only executes the batch file and gives me all the perks a generated launcher would offer.
The current (pretty ugly tbh) workaround is to package a separate executable jar that wraps the execution of the script and can be used by install4j to generate the launcher.
public static void main(String[] args) { try { Runtime.getRuntime().exec("wscript " + BOOTSTRAP_SCRIPT); } catch (Exception e) { e.printStackTrace(); } }
Is there a way to do this with install4j without wrapping the script call?
EDIT: I ended up using the current workaround. The solution in the accepted answer works, but i couldn’t get a launcher with integrated auto-update functionality to work.
Advertisement
Answer
You can use a custom installer application instead of a generated launcher. Under “Installer->Screens & actions”, add an empty installer application and to its startup node add a “Run executable” action that starts the batch script.