Accessing a html file from a menu option does not work when I make a jar or store file

57 views Asked by At

i have a program that when you select the help link in the menu then your default browser opens and a html page opens. when i create a jar or store file the file does not show up. i have tried : ClassLoader.getResourceAsStream() but still not working. my html file is stored in a resources folder and the code for the menu is:

    if (e.getSource() == helpTopic) {
        try {
            URL url = MenuBar.class.getResource("resources/help.html");
            java.awt.Desktop.getDesktop().browse(url.toURI());
        } //end try
        catch (java.io.IOException e1) {
            System.out.println(e1.getMessage());
        } catch (URISyntaxException ex) {
            Logger.getLogger(MenuBar.class.getName()).log(Level.SEVERE, null, ex);
        } //end catch
    }//end if
0

There are 0 answers