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

java, javafx, multithreading

Solution

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

Platform.exit();
System.exit(0);

Problem

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.

Original source

Related problems