<p>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:</p>

<pre><code>Desktop.getDesktop("file:///C:/foo/bar.html#anchor");
</code></pre>

<p>Sun says here <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6477862" rel="noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6477862</a> that anchors are not supported in the file URI protocol.</p>

<p>Does anyone have a better answer?</p>

<p>I can use Java SE 6.  I would be OK with a Windows only solution.</p>

For Windows only, you could try
```
```
System.exec("cmd.exe start file:///C:/foo/bar.html#anchor")
```
```