Launching a browser from IBM Director

This topic describes programming concepts and requirements needed to utilize the browser-launching facility from within IBM Director.

Subtopics

Related information

Related sample code

Understanding BrowserLauncher

The BrowserLauncher class of IBM Director provides a simple method for launching a browser from the console for a specific URL. There are many ways this functionality can be utilized by an application. One way is to use this function as an alternative method of providing the GUI portion of an interactive task. This class provides a single static method, launchURL(), which provides the browser-launching capability you can use.

launchURL()
Calling this method will launch the previously configured browser and will use the contents of the specified URL to determine the initial page to show in the browser.

The syntax of the launchURL() method is:

public static void launchURL( URL u )
         throws IOException

Example:

  // Launch the browser and link us to the IBM home page.
  // Note that this could be any URL an application chooses.
  String urlToLaunch="http://www.ibm.com";
  try {
    BrowserLauncher.launchURL( new URL( urlToLaunch ));
  } catch (IOException ioe) {
    System.out.println( "Exception launching URL:"+ioe );
  }

Configuring BrowserLauncher

IBM Director determines the browser to launch by looking at the BrowserLauncher.properties file. This file specifies one (or more) browsers and their configuration as well as the preferred browser. This file is specific to the system the console is running under. This file is configured outside of the IBM Director environment by an IBM Director Administrator. The file is located on the console in the IBM Director "data" directory. (for example X:\Program Files\IBM\Director\data\BrowserLauncher.properties ).

The following table describes the syntax of the properties and property values that are used to define a browser for IBM Director to use.

Property Name Property Value
browser.current Specifies which of the configured browsers in the properties file is the preferred browser. The index is the number used as the middle portion of the property names below (i.e. replace the x with 1,2, etc.). The index is 1-based
For each browser property defined for a browser, there are potentially three attributes that can be identified by the property key browser.x.attr, where: x = 1, 2, 3, ..., n and n = the number of browsers, and where attr = name, exec, or parm.
browser.x.name This property represents the name of the browser, which could be used by any tools created to allow the user to select the browser to use.
browser.x.exec This property represents the command program to execute to invoke this browser. This is a fully qualified path and executable name for that browser.
browser.x.parm This property represents any parameters to be passed with the command to invoke the browser.