Japanese || XKeymacs | Favorite Utility | JavaHelp | LilyPond | SlickEdit




Reference: Creating Effective Javahelp (Java Series (O'Reilly & Associates).)


How to create JavaHelp content

  1. Create help pages in HTML. (We label these pages as foo*.html.)
  2. Create FooHelp directory next to Foo.jar and create foohelp directory in FooHelp. (./FooHelp/foohelp)
  3. Move foo*.html created at step 0 into foohelp. If there are many files, you can some subdirectory to manage them.
  4. Creating HelpSet file.
    1. Copy IdeHelp.hs from X:\jh1.1\demos\hs\idehelp to FooHelp and rename IdeHelp.hs to FooHelp.hs. (Of course, path of IdeHelp.hs depend on the installed location of JavaHelp)
    2. Open FooHelp.hs and replace Ide* with Foo*.
    3. Modify <title>. This string turns out the window title of your help.
    cf. In XML, <foo bar="baz"/> and <foo bar="baz"></foo> are equivalent.
  5. Creating map file.
    1. Copy Map.jhm from X:\jh1.1\demos\hs\idehelp to FooHelp.
    2. Open Map.jhm, delete lines which look like the next line, and map foo*.html by this format.
      <mapID target="foo" url="foohelp/foo.html" />
  6. Creating a table of contents.
    1. Copy IdeHelpTOC.xml from X:\jh1.1\demos\hs\idehelp to FooHelp and rename IdeHelpTOC.xml to FooHelpTOC.xml.
    2. Open FooHelpTOC.xml, delete lines which look like the next line, and rebuild properly.
      <tocitem text="text" target="target">
      Fill text which is actually displayed in the table of contents, and fill target which is mapped in the Mpa.jhm. To create tree style table of contents, nest tags. If you do not fill target, no action occurs when a user clicks the text. Specify image, and the icon at the left of the text will be changed.
  7. Creating an index.
    1. Copy IdeHelpIndex.xml from X:\jh1.1\demos\hs\idehelp to FooHelp and rename IdeHelpIndex.xml to FooHelpIndex.xml.
    2. Open FooHelpIndex.xml, delete lines which look like the next line, and rebuild properly. You can do just like table of contents.
      <indexitem text="text" target="target">
  8. Creating an index database.
    1. Open Command Prompt, move to FooHelp directory, and run next command.
      C:\bin\jh1.1\javahelp\bin\jhindexer foohelp
  9. Run jar command if needed.
Now, JavaHelp is complete.

How to run JavaHelp by menu or F1 key in Java application

Keywords: JavaHelp, help, Java, application, F1, function key, menu, button
  1. Create JavaHelp content using examples from "How to create JavaHelp contents".
  2. Add the next line in crop of import.
    import javax.help.*;
  3. Add the next fields in a class in which you use help.
    HelpSet hs;
    HelpBroker hb;
  4. Add the next code in constructor.
            try {
                // In the case of putting FooHelp directory in the same directory as Foo.jar.
                // URL hsURL = new URL((new File(".")).toURL(), "FooHelp/FooHelp.hs");
                // In the case of putting foohelp.jar in the same directory as Foo.jar.
                // URL hsURL = new URL("jar:file:foohelp.jar!/FooHelp.hs");
                // In the case of encapsulating JavaHelp contents into the application's jar file.
                URL hsURL = new URL("jar:file:Foo.jar!/jp/ne/hi-ho/cam/oishi/foo/FooHelp/FooHelp.hs");
                // Change jp/ne/hi-ho/cam/oishi/foo for your package name at pleasure.
                hs = new HelpSet(null, hsURL);
            } catch (Exception e) {
            hb = hs.createHelpBroker();
            hb.enableHelpKey(getRootPane(), "overview", hs);        // for F1
  5. Add the next lines under helpItem.setText(); to call help by menu.
    ActionListener helper = new CSH.DisplayHelpFromSource(hb);
    helpItem.addActionListener(helper); // JMenuItem helpItem;
    cf. How to call JavaHelp by button is in accordance with by menu.
Now, you can use a help which is created by JavaHelp on your Java application.

How to convert WinHelp to JavaHelp

I have a feeling that you can make it if you can convert WinHelp to HTML, because JavaHelp is written in HTML.
Refer to Converting WinHelp to HTML Help (KeiYu HelpLab) (written in Japanese) for detail.
Summary of this web site.
  1. Download HTML Help Workshop from Microsoft HTML Help Downloads and install it.
  2. Run HTML Help Workshop and select File -> New.
  3. Select Project.
  4. Check "Convert WinHelp project" and go next.
As for therest, select default setting, and WinHelp will be converted to HTML help.
Appropriate these html files for JavaHelp.


Learning HTML

Minimum HTML to write a help for JavaHelp.
--- Template ---

Basic Tag






<code>Fixed Font</code>



<a href="filename">XKeymacs</a>
<a href="#name">name</a>
<a name="name">name</a>
<img src="filename">

Unorderd List

<ul> </ul>

Ordered List

  1. <li>ol: Ordered List</li>
  2. <li>li: List Item</li>

Definition List

<dd>Definition List<dd>
<dd>Definition Term<dd>
<dd>Definition Description</dd>

Block Quote

<blockquote>Block Quote</blockquote>


data 1 data 2 data 3
<table width=600>
<tr valign="top">
<td width=200>th: Table Header</td>
<td>tr: Table Row</td>
<td>td: Table Data</td>

Horizontal Rule

(C) 2002-2005 oishi@cam.hi-ho.ne.jp