javalinuxpreferencesrobohelp

How can I access preferred applications from Java running on Linux?


We have a multi-platform Java-based system that spawns Robohelp for its online user guide information. It runs on a variety of Windows and Linux flavors. The default Robohelp code that is relevant to our Linux-based systems has a hard-coded link to "netscape" in the command line that it builds to spawn a web browser to view the help files. This is, obviously, less than helpful on a system that does not have netscape installed.

What I would really prefer to do is to detect the Preferred Applications preferences from Java when running on Linux. On the Fedora 9 machine where I'm currently sitting, this is found under System -> Preferences -> Personal -> Preferred Applications. The very first setting is "Web Browser."

How would I detect that setting from Java code?


Solution

  • Have a look at java.awt.Desktop. That supports opening/editing/printing a file in the user's preferred program, opening a URL in the user's preferred browser, sending a eMail, ...