How to launch a file protocol URL with an anchor from Java?

前端 未结 5 1085
深忆病人
深忆病人 2021-01-04 09:08

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

5条回答
  •  再見小時候
    2021-01-04 09:24

    For Windows only, you could try

    System.exec("cmd.exe start file:///C:/foo/bar.html#anchor")
    

提交回复
热议问题