How can I open an HTML file in the default browser from a Java Swing application?

前端 未结 4 602
被撕碎了的回忆
被撕碎了的回忆 2020-12-10 13:33

My Java Swing application generates an HTML file, and I want to open it with the default browser when it is generated and saved. How can I do this?

4条回答
  •  死守一世寂寞
    2020-12-10 13:40

    If you're not using Java 6 (or not sure your users will) - you can use Bare Bones Browser Launcher to launch the default browser. It uses Java 6 Desktop.open() if available, and falls back to platform specific approaches if it's not.

提交回复
热议问题