How to open a PDF file javafx
<p>I want to open a pdf file and display it on new window when a button is clicked 
i try this an it is not working:</p>

<pre><code>Button btn = new Button();

File file=new File("Desktop/Test.pdf");
btn.setText("Open");

btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {

    public void handle(ActionEvent event) {

        try {
            desktop.open(file);
        } catch (IOException ex) {
            Logger.getLogger(Exemple.class.getName())
                .log(Level.SEVERE, null, ex);
        }
    }
});
</code></pre>