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
- Create a project; for example, select . The New Project
wizard opens.
- Enter a project name and select the JRE, which must be
at minimum Java Platform Standard
Edition Version 1.5. Click Next.
- 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.
- 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.
- Set up a run configuration.
- Select . The Run Configurations window
opens.
- In the Name field, enter a name
for the run configuration.
- Select Java Application and the New icon.
- Click Search to select PRSXmlResultReaderExample as
the main class; click OK.
- Set up variables to prompt for the implementation arguments.
Select the (x)=Arguments tab.
- 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.
- 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.