I\'m using Java 1.5 and I\'d like to launch the associated application to open the file. I know that Java 1.6 introduced the Desktop API, but I need a solution for J
Another answer (by boutta) suggests using SWT. I wouldn't recommend referencing the library for this purpose only, but if you are using it already, simply execute:
Program.launch("http://google.com/");
Take note that this method will only work (and return true) if a Display object has already been created (for instance by creating a Shell). Also take note that it must run in the main thread; e.g.:
Display.syncExec(new Runnable() {
public void run() {
Program.launch("http://google.com/");
}
});
In the example above I've launched a URL, but launching files works in the same way.