1

I would like to be able to have my application restarted automatically every night. Is this something that is possible to achieve using the ApplicationLauncher API of Install4j and how?

Thanks!

ixM
  • 1,244
  • 14
  • 29
  • 1
    how about [this](https://stackoverflow.com/q/4159802/896249)? It doesn't include Install4J, but when you can do this in Java.... – GameDroids Jan 18 '21 at 14:38
  • Thanks for commenting but it looks like this answer shouldn't have been accepted looking at the comments. Moreover, Install4J wraps the executable which means that, AFAIK, you don't actually start the Java application itself but rather the Install4J launcher which also happens to prevent multiple startup of the same application. So I assumed that it would only be possible to do this through the ApplicationLauncher API. – ixM Jan 18 '21 at 14:57

1 Answers1

1

Add a custom installer application on the Installer->Screens & Actions step with the "Default execution mode" property set to "Unattended mode".

In the "Startup" node, add a "Shut down calling launcher" action and a "Execute launcher" action.

To restart, call

ApplicationLauncher.launchApplication("<ID of the application>", null, false, null);
Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • Thanks, I actually saw another of your answers that mentioned this but i couldn't figure out how to add the installer. Perhaps, I was missing the screens & actions part and gave up searching too quickly. I'll try it out and report back. Are you pay of the install4j team? Love the product! – ixM Jan 18 '21 at 16:06
  • 1
    It worked flawlessly, thanks so much! I wasn't able to figure out how to create the custom installer application at first, it was as simple as clicking on the green plus button, then selecting "Add application" to find the "Empty custom application". I also had to specify an arbitrary executable name in the same properties dialog where I checked the "unattended mode". Thanks again! – ixM Jan 18 '21 at 22:43