G.3. Desktop Class
Java SE 6’s new Desktop class enables you to specify a file or URI that you’d like to open using the underlying platform’s appropriate application. For example, if Firefox is your computer’s default browser, you can use the Desktop class’s browse method to open a web site in Firefox. In addition, you can open an email composition window in your system’s default email client, open a file in its associated application and print a file using the associated application’s print command. Figure G.2 demonstrates the first three of these capabilities.
Figure G.2. Use Desktop to launch the default browser, open a file in its associated application and compose an email in the default email client.
1 // Fig. G.2: DesktopDemo.java