How to launch standard browser out of Java application?
- by Peter
Hi there
how to I open a URL with the systems standard browser with Java?
I currently use this code for opening a specific URL (locally stored html file), which works fine when I run the application with my IDE (Eclipse), but after bundling the software, it doesn't work any more.
    url = MainWindow.class.getResource("mySite.html");
    helpMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {    
            try {
                java.awt.Desktop.getDesktop().browse(url.toURI());
            }
            catch (URISyntaxException e1) {
                e1.printStackTrace();
            }
            catch (IOException e1) {
                e1.printStackTrace();
            }
        }
    });
Any suggestsions?
Thank you very much!