开发者

Java Web start - how to detect when app is closed?

How do you detect when an App is open or c开发者_C百科losed?

  1. User clicks on link/button.
  2. Web Browser launches Java desktop app via Java Web Start.

At this point how do you have the browser detect if the App is able to launch or unable to launch, if the app has launched and closed by the user?


Do you registered the class containing windowClosing() method via addWindowListener()?

Java explicitly allows you to close process, please check below code:

Runtime.getRuntime().addShutdownHook(new Thread() {

    @Override
    public void run() {
        // you can write your code here
    }
});


..how do you have the browser detect if the App is able to launch ..

Start with having the app. inform the server that it has started (or is about to exit). Then set up some mechanism for the browser to poll the server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜