nl.nikhef.slcshttps.util
Class BareBonesBrowserLaunch

java.lang.Object
  extended by nl.nikhef.slcshttps.util.BareBonesBrowserLaunch

public class BareBonesBrowserLaunch
extends Object

Static class to provide a way to launch a proper default webbrowser from Java. In JDK 1.6 onwards this is done using java.awt.Desktop.browse(), for older JDK versions we provide sensible defaults. Supported platforms are: Mac OS X, GNU/Linux, Unix, Windows.

Author:
Dem Pilafian, Willem van Engen (wvengen@nikhef.nl), Mischa Sallé adapted for use by nl.nikhef.slcshttps

Field Summary
private static String[] browsers
          Browsers to try for Unix/Linux.
private static String errMsg
          error message used upon failure.
private static String OS_MAC
          String to identify Mac OS, it should start with "Mac OS".
private static String OS_WIN
          String to identify Windows, it should start with "Windows".
 
Constructor Summary
BareBonesBrowserLaunch()
           
 
Method Summary
static void openURL(String url)
          opens a webbrowser to a URL, tries first the JDK 1.6 java.awt.Desktop.getDesktop().browse(new URI(url)) method, if that fails the action is platform dependent.
static void openURL(URL url)
          Opens a webbrowser to a URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

browsers

private static final String[] browsers
Browsers to try for Unix/Linux.


OS_MAC

private static final String OS_MAC
String to identify Mac OS, it should start with "Mac OS".

See Also:
Constant Field Values

OS_WIN

private static final String OS_WIN
String to identify Windows, it should start with "Windows".

See Also:
Constant Field Values

errMsg

private static final String errMsg
error message used upon failure.

See Also:
Constant Field Values
Constructor Detail

BareBonesBrowserLaunch

public BareBonesBrowserLaunch()
Method Detail

openURL

public static void openURL(URL url)
                    throws Exception
Opens a webbrowser to a URL.

Parameters:
url - url to open, type URL.
Throws:
Exception - upon error.
See Also:
openURL(String)

openURL

public static void openURL(String url)
                    throws Exception
opens a webbrowser to a URL, tries first the JDK 1.6 java.awt.Desktop.getDesktop().browse(new URI(url)) method, if that fails the action is platform dependent.

Parameters:
url - url to open, type String
Throws:
Exception - upon error.


nl.nikhef.slcshttps Mischa Sallé - msalle(AT)nikhef.nl