JavaFX应用程序在关闭后仍然运行
关闭我的javaFX应用程序时遇到问题,当我点击我的舞台上的关闭按钮时,我的应用程序消失但是如果我在我的任务管理器中找到它,我的应用程序仍然没有关闭。
我试图使用下面的代码强制它关闭主线程和所有子线程,但问题仍然存在。
I'm having problem to close my javaFX application, when I click the close button from my stage, my application disappears but if I look for it in my task manager my application still there without close. I've tried to use this code below to force it close the main thread and all childrens threads but the problem persists.
primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent t) {
Platform.exit();
}
});
您的应用程序是否会生成任何子线程?如果有,你确保你终止它们(假设它们不是守护程序线程)?
Does your application spawn any child threads? If so have you ensured that you terminate them (assuming that they're not daemon threads)?
如果你的应用程序产生非守护程序线程那么它们(以及你的应用程序) )将继续活着,直到你杀死这个过程为止
If your application spawns non-daemon threads then they (and therefore your app) will continue to live on until such time you kill the process