 <p>Maybe what you want is like this : </p> <pre><code>public void startApp(){ primaryStage.show(); new Thread(new Runnable(){ @Override public void run() { try { Thread.sleep(20000);//2 seconds } catch (InterruptedException e) { e.printStackTrace(); } //do something......... System.out.println("all things done"); } }).run(); } </code></pre> <p>You need to implement the method <code>run()</code> of <code>Runnable</code></p>