Llorenç Camps
Llorenç Camps

Reputation: 13

Install4j - Application doesn't stop when shutting down MacOS X

I've created a GUI Application launcher, and when it finish the installation the launcher starts and the application works perfectly, but when I try to shut down the MacOS, the PC doesn't stop, and I have to kill the application manually.

The installer version for Windows and Linux works correctly and doesn't have this problem which only appears in MAC OS X.

I'm not sure if it's directly related but to give more context the application launch a Jetty web app server which uses an https on some free port in 9091-9095 range. Additionally I'm embedding a JRE 1.8 update 112 version.

Any idea on how can create the launcher and do the application stops correctly when shutting down the MacOS?

Upvotes: 1

Views: 143

Answers (1)

Ingo Kegel
Ingo Kegel

Reputation: 48035

You can register a quit handler like this:

import com.apple.eawt.*;
Application.getApplication().setQuitHandler(new QuitHandler() {
    @Override
    public void handleQuitRequestWith(AppEvent.QuitEvent quitEvent, QuitResponse quitResponse) {
        System.exit(0);
    }
});

Upvotes: 1

Related Questions