Running the sample XML reader implementation in an IDE

The Prerequisite Scanner Java™ Developer toolkit contains a sample implementation of the Prerequisite Scanner Java API that you can review and use a reference. You can run the sample implementation in your integrated development environment.

Before you begin

Before you run the sample implementation, ensure that you run Prerequisite Scanner and specify the xmlResult input parameter to output the scan results to both the text and XML files.

About this task

The path and file name for the sample implementation is ips_root/api/examples/com/ibm/prs/common/reports/api/example/PRSXmlResultReaderExample.java.

The sample implementation takes two arguments, the fully qualified path and file name of the result XML file and the fully qualified path and file name of the XML schema file.

Note: This procedure runs the sample implementation in an Eclipse-integrated development environment; it is not mandatory to use Eclipse as your IDE.

Procedure

  1. Create a project; for example, select File > New > Java Project. The New Project wizard opens.
  2. Enter a project name and select the JRE, which must be at minimum Java Platform Standard Edition Version 1.5. Click Next.
  3. Set up Java build path. Select the Libraries tab. Click Add External JARs. Browse to the ips_root/api/jar/prs_api.jar file. Click Finish.
  4. Copy the sample implementation source file, that is, ips_root/api/examples/com/ibm/prs/common/reports/api/example/PRSXmlResultReaderExample.java to the source directory of the new Java project. Ensure that your refresh the Java project in your IDE.
  5. Set up a run configuration.
    1. Select Run > Run Configurations. The Run Configurations window opens.
    2. In the Name field, enter a name for the run configuration.
    3. Select Java Application and the New icon.
    4. Click Search to select PRSXmlResultReaderExample as the main class; click OK.
    5. Set up variables to prompt for the implementation arguments. Select the (x)=Arguments tab.
    6. In the Program arguments text box, enter the following variables:
      ${file_prompt:args[0]} ${file_prompt:args[1]}

      The ${file_prompt} variable opens a browse window when the sample application is run.

    7. Click Apply and then Run.

      When you run the sample implementation, you are prompted to browse and select the result.xml and PRSReader.xsd files, in the ips_root directory.