Hi,
I'm trying to figure out how to open system preferred editor for given file.
Say, we have a file manager, written in Java. User goes to folder and see list of files. And, for example, there are file "Icon.jpg". User double clicks on the filename and file opens in system's preferred editor (i.e. Gimp). The main issue is - how to do that?
We can do Runtime.getRuntime().exec("something file"), but this way you should know which program is preferred in user environment. But how?
We also are able to do Desktop.getDesktop().edit(File file), but this way we cannot track process and aren't able to know then this child process is closed. Other issue - function doesn't works on linux (at least on Ubuntu 8.10). There also is Desktop.getDesktop().open(File file), but it forses to open file viewer, instead of system viewer for that file type.
I am searching for solution all week, but didn't got any suitable and generic one. Do you know the other approaches to this question? For my project it would be enough if it would work on Windows+Linux+Mac.
Thank you for your answers and advices.
//Edit on 2009-02-08 23:04
Other suggestion: can I force "application selection" window in Windows and in Linux, as in Mac with "open file"? For example, then you trying to open file, you are being asked to choose application from list of system preferred ones? (something like "Open with..." in windows explorer). Do you know?