Viewing HelpSets

A HelpSet viewer is provided with the release to enable you to view HelpSets that you create. The viewer is only available on the JavaTM 2 Platform and will not work with JDK/JRE1.1. Use the following command to execute the viewer:

java -jar demos/bin/hsviewer.jar

JavaTM 2 Platform

If you use the Java 2 Platform to run the JavaHelp system demos, use the hsviewer.jar executable JAR file to view HelpSets.

On a Microsoft Windows system you can start this program by double-clicking hsviewer.jar. When the program starts, specify the name of a HelpSet file and the path to that HelpSet file. You can also use the file chooser to load a HelpSet (Browse button). Once loaded, click Display to view the HelpSet in the JavaHelp system viewer.

You can also use the hsviewer.jar file to create batch files, script files, or JAR files that automate the viewing process. The following describes the syntax of the hsviewer.jar command-line interface:

java -jar hsviewer.jar [-helpset hs_name]

The -helpset option specifies the HelpSet name hs_name

The name of a HelpSet file. The hsviewer searches the CLASSPATH and loads the first HelpSet file it encounters with that name. For example:

C:\> hsviewer -helpset HolidayHelpSet.hs


If no arguments are specified on the command line, the graphical interface is used.

Displaying a HelpSet with an Executable JAR File

Using this release you can display a specific HelpSet using the sunw.demo.jhdemo.Runner class in hsviewer.jar. Using a manifest file to define the Class-Path, Run-Class, and Arguments it is possible to display a HelpSet in a standalone environment. Below is the manifest file used to display the JavaHelp User's Guide (this HelpSet):

Main-Class: sunw.demo.jhdemo.Runner
Run-Class: sunw.demo.jhdemo.JHLauncher
Class-Path: ../../javahelp/lib/jh.jar hsviewer.jar ../../doc/jhug/
Arguments: -helpset jhug.hs

The following describes the syntax of the manifest file:

Main-Class: sunw.demo.jhdemo.Runner
Run-Class: sunw.demo.jhdemo.JHLauncher
Class-PATH: [jar file | directory]
Arguments: [valid arguments for Run-Class]

Main-Class The main class that is executed when this JAR file is run. This is a standard argument for executable JAR files. For HelpSets this value is always sunw.demo.jhdemo.Runner. For example:

Main-Class: sunw.demo.jhdemo.Runner

Run-Class The class that the sunw.demo.jhdemo.Runner executes. For HelpSets this value is always sunw.demo.jhdemo.JHLauncher. For example:

Run-Class: sunw.demo.jhdemo.JHLauncher<

Class-Path The class path to use with the Run-Class. A space separated list of JAR files or directories to be added to existing classpath environment variable. Note that the files must be specified relative to the location of the executable JAR file. For example:

Class-Path: ../../javahelp/lib/jh.jar hsviewer.jar ../../doc/jhug/ <

Arguments Arguments passed to the Run-Class when executed. For viewing HelpSets, this always includes the -helpset option with the path to the HelpSet file. For example:

-helpset jhug.hs

For the final step you use the jar command to create an executable JAR file. The JAR file contains only one file -- the manifest file. All other files specified in the Class-Path argument must be specified relative to the JAR file. The jar command to create the manifest file is:
jar -cmf manifest_file jar_file
where manifest_file is the name of your manifest file and jar_file in the name of the JAR file you wish to create.

An example usage of the jar command is:

C:\> jar -cmf manifest UsersGuide.jar