1

I am programming a JavaFX Application which shows an undecorated stage. To close my application, I use a button, which calls the method System.exit(0); The problem is that I get sometimes this exception without links to my code when I use it:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException: Cannot invoke "com.sun.prism.GraphicsPipeline.is3DSupported()" because the return value of "com.sun.prism.GraphicsPipeline.getPipeline()" is null
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.isSupported(QuantumToolkit.java:1208)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.isSupportedImpl(PlatformImpl.java:960)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.isSupported(PlatformImpl.java:627)
at javafx.graphics/javafx.application.Platform.isSupported(Platform.java:252)
at javafx.graphics/com.sun.javafx.scene.input.PickResultChooser.processOffer(PickResultChooser.java:182)
at javafx.graphics/com.sun.javafx.scene.input.PickResultChooser.offer(PickResultChooser.java:143)
at javafx.graphics/javafx.scene.Node.intersects(Node.java:5226)
at javafx.graphics/javafx.scene.Node$1.intersects(Node.java:544)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.intersects(NodeHelper.java:258)
at javafx.graphics/javafx.scene.layout.Region.doPickNodeLocal(Region.java:3161)
at javafx.graphics/javafx.scene.layout.Region$1.doPickNodeLocal(Region.java:184)
at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.pickNodeLocalImpl(RegionHelper.java:104)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.pickNodeLocal(NodeHelper.java:128)
at javafx.graphics/javafx.scene.Node.pickNode(Node.java:5199)
at javafx.graphics/javafx.scene.Parent.pickChildrenNode(Parent.java:806)
at javafx.graphics/javafx.scene.Parent$1.pickChildrenNode(Parent.java:136)
at javafx.graphics/com.sun.javafx.scene.ParentHelper.pickChildrenNode(ParentHelper.java:113)
at javafx.graphics/javafx.scene.layout.Region.doPickNodeLocal(Region.java:3160)
at javafx.graphics/javafx.scene.layout.Region$1.doPickNodeLocal(Region.java:184)
at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.pickNodeLocalImpl(RegionHelper.java:104)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.pickNodeLocal(NodeHelper.java:128)
at javafx.graphics/javafx.scene.Node.pickNode(Node.java:5199)
at javafx.graphics/javafx.scene.Parent.pickChildrenNode(Parent.java:806)
at javafx.graphics/javafx.scene.Parent$1.pickChildrenNode(Parent.java:136)
at javafx.graphics/com.sun.javafx.scene.ParentHelper.pickChildrenNode(ParentHelper.java:113)
at javafx.graphics/javafx.scene.layout.Region.doPickNodeLocal(Region.java:3160)
at javafx.graphics/javafx.scene.layout.Region$1.doPickNodeLocal(Region.java:184)
at javafx.graphics/com.sun.javafx.scene.layout.RegionHelper.pickNodeLocalImpl(RegionHelper.java:104)
at javafx.graphics/com.sun.javafx.scene.NodeHelper.pickNodeLocal(NodeHelper.java:128)
at javafx.graphics/javafx.scene.Node.pickNode(Node.java:5199)
at javafx.graphics/javafx.scene.Scene$MouseHandler.pickNode(Scene.java:3999)
at javafx.graphics/javafx.scene.Scene.pick(Scene.java:2031)
at javafx.graphics/javafx.scene.Scene$MouseHandler.process(Scene.java:3809)
at javafx.graphics/javafx.scene.Scene.processMouseEvent(Scene.java:1851)
at javafx.graphics/javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2584)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:409)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:299)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$2(GlassViewEventHandler.java:447)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:412)
at javafx.graphics/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:446)
at javafx.graphics/com.sun.glass.ui.View.handleMouseEvent(View.java:556)
at javafx.graphics/com.sun.glass.ui.View.notifyMouse(View.java:942)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:832)
1
  • 2
    Try using Platform.exit() instead of System.exit(0);. That will cleanly shut down the JavaFX subsystem; if there are no non-daemon threads running it will subsequently cause the JVM to exit. Commented May 6, 2021 at 15:37

2 Answers 2

2

call Platform.exit() instead of System.exit();

Sign up to request clarification or add additional context in comments.

Comments

0

There is another option to use following, if we still need to call

System.exit()

.

Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        System.exit(0);
                    }
                });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.