My Java Swing application generates html file and I want to open it with default browser when it is generated and saved. How to achieve that?
+5
A:
If you are using Java 6, use Desktop.open(). It allows you to open any file with the default application associated with its file type on the system.
Chandru
2010-02-24 02:09:27
Just remember the edge case when using this. For example a web developer probably has some sort of editor/ide set as their default app to open html files. Might need to dig a little deeper if developers are part of your main users.
Carnell
2010-02-24 04:32:56
+3
A:
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.
Nate
2010-02-24 03:34:45