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

前端 未结 5 1130
深忆病人
深忆病人 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:30

    Solution on Windows is:

    rundll32 URL.dll, FileProtocolHandler "file:///x:/temp/fragtest.htm#frag"

    Mind the quotes!!!

    rundll32 URL.dll, FileProtocolHandler file:///x:/temp/fragtest.htm#frag does work as expected.

提交回复
热议问题