I want view a PDF file in my JavaFX project with the HostServices hostServices.
In the application, I want to show the PDF when a button is clicked, but I always get a NullPointerException when I click the button. How can I fix that?
This is my code:
private void showPdf(){
    File file = new File("/home/ousainou/Documents/Biometric/Report.pdf");
    HostServices hostServices = getHostServices();
    hostServices.showDocument(file.getAbsolutePath());                
}
 
    