JavaFX Application doesn't terminate after using Platform.exit()


Question

I am using JavaFX 2.2 and i have a class which extends Application Class. Here is my code. After that my program finished it's work, it doesn't terminate and continue it's life. What shod I do?

new JFXPanel();
Platform.runLater(new Runnable() {
        @Override
        public void run() {
            ApplicationExtendedClass s = new ApplicationExtendedClass();
            s.start(new Stage());
        }
    });
    synchronized (SynchronyzingObject.getInstance()) {
        try {
            SynchronyzingObject.getInstance().wait();
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    Platform.exit();

I use SynchronyzingObject to synchronize work between my threads and wait the work of another thread end and then Platform.exit() works to exit that. Also I wrote Platform.exit() in the end of work of that thread, before notifying the SynchronyzingObject. What should I do in order to my program get finished.

EDIT :

This application runs in the middle of another program in order to do some data and adding them to database, and after finish of this program i don't want my whole project get closed, I just want thread of this application got terminate.

1
5
12/19/2013 10:54:22 AM

Use System.exit(0); with your code for closing the application.

Platform.exit();
System.exit(0);
10
12/10/2013 8:46:34 AM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon