From a Java program, I need to launch the default browser on a local HTML file, pointed to an anchor inside the file. In Java SE 6, the java.awt.Desktop.browse method will open the file, but will not honor the anchor, so something like the following opens the file at the top, but does not page the browser to the anchor:
Desktop.getDesktop("file:///C:/foo/bar.html#anchor");
Sun says here http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6477862 that anchors are not supported in the file URI protocol.
Does anyone have a better answer?
I can use Java SE 6. I would be OK with a Windows only solution.