View Javadoc

1   package de.matthias_burbach.mosaique.core.util;
2   
3   /***
4    * @author Matthias Burbach
5    */
6   public final class BrowserLauncher {
7       /***
8        * Empty default constructor to enforce static usage of this utility class.
9        */
10      private BrowserLauncher() {
11          //nothing to do
12      }
13  
14      /***
15       * Launches a browser to display a URL.
16       *
17       * @param url The URL to display.
18       */
19      public static void openUrl(final String url) {
20          try {
21              /*
22               * The following only works on Windows...
23               */
24              Runtime.getRuntime().exec("cmd.exe /c start " + url);
25          } catch (Exception e) {
26              e.printStackTrace();
27          }
28      }
29  }