How do you detect when an App is open or c开发者_C百科losed?
- User clicks on link/button.
- 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.
精彩评论