我有两个不同的JavaFX程序正在运行。当一个关闭时,它也会向另一个应用程序发送一条消息以也关闭。如果我用Platform.exit()
关闭了第一个应用程序,则当我用Platform.exit()
关闭了第二个应用程序时,它关闭了,但是我得到了
Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
at com.sun.javafx.tk.quantum.QuantumToolkit.isSupported(QuantumToolkit.java:1153)
at com.sun.javafx.application.PlatformImpl.isSupportedImpl(PlatformImpl.java:809)
at com.sun.javafx.application.PlatformImpl.isSupported(PlatformImpl.java:482)
at javafx.application.Platform.isSupported(Platform.java:168)
at com.sun.javafx.scene.input.PickResultChooser.processOffer(PickResultChooser.java:182)
at com.sun.javafx.scene.input.PickResultChooser.offer(PickResultChooser.java:143)
at javafx.scene.Node.impl_intersects(Node.java:4945)
at javafx.scene.layout.Region.impl_pickNodeLocal(Region.java:2942)
at javafx.scene.Node.impl_pickNode(Node.java:4914)
at javafx.scene.layout.Region.impl_pickNodeLocal(Region.java:2936)
at javafx.scene.Node.impl_pickNode(Node.java:4914)
at javafx.scene.Scene$MouseHandler.pickNode(Scene.java:3899)
at javafx.scene.Scene$MouseHandler.access$1600(Scene.java:3485)
at javafx.scene.Scene.pick(Scene.java:1942)
at javafx.scene.Scene.access$6700(Scene.java:159)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3711)
at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
at com.sun.glass.ui.View.notifyMouse(View.java:937)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Unknown Source)
如果我使用System.exit(0)
关闭第一个应用程序,则用Platform.exit()
关闭第二个应用程序时不会出现此错误。
可能是什么问题?