I'm developing a java application for a college job and I have a help section for the user where I open a html
page in the browser, or at least should open it.
The point is that if files with .html
extension were by default of the system to be opened by a browser, as well it will be opened by the browser, however if this extension is linked by default, for example, to an editor of text it will open in the text editor revealing the code.
I wonder if there is a java mode of a html
document only to be opened by the browser. The code I use is the one below:
Desktop desktop = null;
desktop = Desktop.getDesktop();
URI url = null;
File file = new File("src/ajuda/index.html");
try {
url = new URI(file.toURI().toString());
desktop.browse(url);
} catch (URISyntaxException | IOException ex) {
Logger.getLogger(Teste.class.getName()).log(Level.SEVERE, null, ex);
}