% compile 3 timws:     latex   tex4ht-javahelp   
%                  or  xhlatex tex4ht-javahelp "html,3,sections+"
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% tex4ht-javahelp.tex                                    %
% Copyright (C) 2003--            Eitan M. Gurari        %
%                                                        %
% This work may be distributed and/or modified under the %
% conditions of the LaTeX Project Public License, either %
% version 1.3 of this license or (at your option) any    %
% later version. The latest version of this license is   %
% in                                                     %
%   http://www.latex-project.org/lppl.txt                %
% and version 1.3 or later is part of all distributions  %
% of LaTeX version 2003/12/01 or later.                  %
%                                                        %
% This work has the LPPL maintenance status "maintained".%
%                                                        %
% This Current Maintainer of this work                   %
% is Eitan M. Gurari.                                    %
%                                                        %
% If you modify this file your changing the signature    %
% in \message{(signature)} below will be appreciated.    %
%                                                        %
%                             gurari@cse.ohio-state.edu  %
%                 http://www.cse.ohio-state.edu/~gurari  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%   
\message{(<signature>)}


\documentclass{article}

  \ifx \HCode\Undef
     \usepackage[xhtml,sections+,3]{tex4ht}
  \fi

  \usepackage{url}
  \usepackage{moreverb}
  \Configure{ProTex}{foo,<<<>>>,title,|,list,[[]]}

\begin{document}
\newcount\tmpcnt  \tmpcnt\time  \divide\tmpcnt  60
\edef\temp{\the\tmpcnt}
\multiply\tmpcnt  -60 \advance\tmpcnt  \time

\edef\version{\the\year-\ifnum \month<10 0\fi
  \the\month-\ifnum \day<10 0\fi\the\day
   -\ifnum \temp<10 0\fi \temp
   :\ifnum \tmpcnt<10 0\fi\the\tmpcnt}

\def\CopyYear.#1.{%
   \ifnum #1=\year #1\space\space\space\space\space\space
    \else          #1--\the\year\fi
}


\def\JHDIR{...../}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Review}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

JavaHelp is an online documentation system for use by Java-based
applications. 
It can be activated with the
`javahelp' options. For instance, 
`\verb+htlatex jobname "html,3,3.2,javahelp"+'.

TeX4ht does the following for JavaHelp

\begin{itemize}
\item Creates keys for the entries in the table of contents
and the index
\item Maps the keys into th erl's of the toc and the index (jobname.jhm)
\item Maps the keys to the entries referenced by the toc (jobname-jht.xml)
and to the entries referenced by the toc (jobname-jhi.xml)
\item Creates a manifest of the files (jhelpset.hs), under the assumption
that jhindexer set a search directory at jobname-jhs
`{\tt java -jar /n/gold/5/gurari/javahelp.dir/jh1.1.3/javahelp/bin/jhindexer.jar -db jobname-jhs *.html}'
\end{itemize}

The javahelp.4ht file should not be loaded before the leading
\verb+\tableofcontents+ command got active.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{References}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{itemize}
\item \url{C:/jh1.1.3/doc/spec/FileFormat.html}
\item \url{http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/javahelp/javahelp.html}
\item \url{http://developer.java.sun.com/developer/JDCTechTips/2002/tt0423.html}
\item \url{http://developer.java.sun.com/developer/JDCTechTips/2002/tt0521.html}
\item \url{http://www.oreilly.de/catalog/creatingjavahelp/examples/}
\end{itemize}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The JavaHelp Files}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The HTML Documentation (*.html)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Prepare a \LaTeX{} file and compile it for HTML 3.2. For instance,
with the command {\tt htlatex jobname "html,3.2,3,javahelp"}.

% \special{t4ht>foo.log}
% \special{t4ht=...x...}
% \special{t4ht*>foo.log}
% \special{t4ht*>}


\<javahelp.4ht\><<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
% javahelp.4ht                          |version %
% Copyright (C) |CopyYear.2003.       Eitan M. Gurari         %
|<TeX4ht copyright|>
|<instructions for log|>
|<jh defs|>
\Configure{Preamble}
  {}
  {|<jh at start|>}
\Configure{@/BODY}
  {\relax
   \ifnum \FileNumber=1
        \input javahelp-a.4ht
   \fi
  }
>>>

\<jh defs\><<<
\def\Write:File#1#2{%
  \special{t4ht>#1}%
  \special{t4ht=#2}%
  \special{t4ht*>#1}%
  \special{t4ht*>}%
}
>>>






\<javahelp-a.4ht\><<<
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  
% javahelp-a.4ht                       |version %
% Copyright (C) |CopyYear.2003.       Eitan M. Gurari         %
|<TeX4ht copyright|>
\NextFile{\jobname.tmp}
\HPage{}
\bgroup 
   \catcode`\:=11
   \catcode`\@=11
   \catcode`\"=12
   \Configure{PROLOG}{}   
   \Configure{HtmlPar}{}{}{}{}
   \Configure{tableofcontents}{}{}{}{}{}
   \Configure{htf}{0}{+}{}{}{}{}{}{}{}
   \ScriptEnv{dito}{\IgnorePar}{}
   |<jh util|>
   |<jh root|>
   |<jh toc|>
   |<jh index|>
   |<jh at end|>
\egroup
\EndHPage{}
>>>

The HPage above is to ensure the all the references in the javahelp
files will be to locations at other files, and so they will explicitly
include the names of the files being referenced.  The page is empty
and not referenced by other pages.

\<instructions for log\><<<
\immediate\write-1{--------------- JavaHelp -----------------}
\immediate\write-1{The entry (HelpSet) file for the java program
                                         is at `\jobname.hs'}
\immediate\write-1{Generate a search database
                             with, for instance, the command}
  \immediate\write-1{ java -jar
    ...../jh1.1.3/javahelp/bin/jhindexer.jar
    -db \jobname-jhs \jobname*.html}
\immediate\write-1{Compile the java program with a command similar to}
  \immediate\write-1{ javac -classpath
    ...../jh1.1.3/javahelp/lib/jh.jar  program.java}
\immediate\write-1{Run the java program with a command similar to}
  \immediate\write-1{ java -classpath
    ...../jh1.1.3/javahelp/lib/jh.jar;. program}
\immediate\write-1{JavaHelp might require a compilation for HTML 3.2,
     for instance,}
\immediate\write-1{ htlatex \jobname\space "html,javahelp,3.2,3"}
\immediate\write-1{------------------------------------------}
>>>



\<jh defs\><<<
\def\jhNote{%
     Created for JavaHelp
     (http://java.sun.com/products/javahelp/)\Hnewline
     by TeX4ht (http://www.cse.ohio-state.edu/\string
     ~gurari/TeX4ht/)\Hnewline from \jobname.tex at \:today \space
  }
>>>

We can't keep the comment boundaries 
in the macro because the adjacent hyphens
in some cases merge into a n-dash
  under font encoding T1. For instance,

\begin{verbatim}
   \documentclass{report} 
     \usepackage[T1]{fontenc}        
   \begin{document} 
    
   \ScriptEnv{dito}{}{} 
    
   \begin{dito} 
   --[]-[] 
   \end{dito} 
   \end{document} 
\end{verbatim}



\<tex4ht note\><<<
\jhNote
>>>



\<TeX4ht copyright\><<<
%                                                        %
% This work may be distributed and/or modified under the %
% conditions of the LaTeX Project Public License, either %
% version 1.3 of this license or (at your option) any    %
% later version. The latest version of this license is   %
% in                                                     %
%   http://www.latex-project.org/lppl.txt                %
% and version 1.3 or later is part of all distributions  %
% of LaTeX version 2003/12/01 or later.                  %
%                                                        %
% This work has the LPPL maintenance status "maintained".%
%                                                        %
% This Current Maintainer of this work                   %
% is Eitan M. Gurari.                                    %
%                                                        %
% If you modify this program your changing its signature %
% with a directive of the following form will be         %
% appreciated.                                           %
%            \message{signature}                         %
%                                                        %
%                             gurari@cse.ohio-state.edu  %
%                 http://www.cse.ohio-state.edu/~gurari  %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\immediate\write-1{version |version}
>>>



\<par del\><<<
!*?: >>>





\<jh defs\><<<
\Configure{crosslinks}{}{}{}{}{}{}{}{}{}
>>>


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The JavaHelp Root File (HelpSet File: jobname.hs)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

This file introduces the files in the help distribution.


\<url of jh root file\><<<
\jobname.hs>>>


The etension name must be `hs'!



\<dtd lang\><<<
\dTdLaNg>>>

\<jh defs\><<<
\def\dTdLaNg{\expandafter
  \ifx \csname a:dtd-lang\endcsname\relax EN\else
    \csname a:dtd-lang\endcsname
  \fi   }
>>>

\<jh root\><<<
|<jh root config|>
\IgnorePar\par\leavevmode\special{t4ht>|<url of jh root file|>}%
\begin{dito}-\
<?xml version="1.0" encoding="ISO-8859-1" ?>
\end{dito}
|<helpset DTD|>
\begin{dito}-\
<!-\relax- |<tex4ht note|> -\relax->
<helpset version="\dotVersion">
  <title>|<title label|></title>
  <maps>
    <homeID>|<home id|></homeID>
    <mapref location="|<url of jh keys file|>"/>
  </maps>
  <view>
    <name>TOC</name>
    <label>|<toc label|></label>
    <type>javax.help.TOCView</type>
    <data>|<url of jh toc file|></data>
  </view>
  <view>
    <name>Index</name>
    <label>|<index label|></label>
    <type>javax.help.IndexView</type>
    <data>|<url of the jh index|></data>
  </view>
  <view>
    <name>Search</name>
    <label>|<search dir label|></label>
    <type>javax.help.SearchView</type>
    <data 
      engine="com.sun.java.help.search.DefaultSearchEngine">|<url of jh serach dir|></data>
  </view>
</helpset>
\end{dito}
\IgnorePar\par\leavevmode\special{t4ht<|<url of jh root file|>}
>>>



\<toc label\><<<
\tocLabel>>>

\<index label\><<<
\indexLabel>>>

\<search dir label\><<<
Search>>>

\<title label\><<<
\titleLabel>>>


\<jh root config\><<<
\edef\tocLabel{\ifx\contentsname\:UnDef Table Of Contents\else
               \ifx\contentsname\empty  Table Of Contents\else 
               \contentsname\fi\fi}
\edef\indexLabel{\ifx\indexname\:UnDef Index\else
                 \ifx\indexname\empty  Index\else \indexname\fi\fi}
\ifTag{TITLE+}
   {\edef\titleLabel{\LikeRef{TITLE+}}}
   {\def\titleLabel{\jobname}}
>>>



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The JavaHelp Search Directory (jobname-jhs)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\<url of jh serach dir\><<<
\jobname-jhs>>>

\def\JHINDEXER{java -jar
\JHDIR jh1.1.3/javahelp/bin/jhindexer.jar
    -db \jobname-jhs \jobname*.html}




Use a  command similar to `{\tt \JHINDEXER}'
to create a search directory \verb+JavaHelpSearch+ for JavaHelp from the HTML pages of the documentation.





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The JavaHelp Keys to URLs Mapping (jobname.jhm)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%



\<url of jh keys file\><<<
\jobname.jhm>>>


The homeId tag provides the default entry to present when a HelpSet is
first shown.

\<home id\><<<
\jobname>>>                

The default  entry point can be overwritten in:

\<entry point\><<<
\jobname>>>



Assigns keys to locations within the HTML document.



\<jh at start\><<<
\Write:File
   {|<url of jh keys file|>}
   {|<map preamble|>}
>>>


\<map preamble\><<<
<?xml version="1.0" encoding="ISO-8859-1" ?>\Hnewline
|<map DTD|>
\Hnewline <!-- |<tex4ht note|> -->\Hnewline
<map version="\dotVersion">\Hnewline
<mapID target="|<entry point|>" url="\jobname.html"/>\Hnewline
>>>


\<jh defs\><<<
\HAssign\mapEntry=0
>>>


\<add index entry to map\><<<
\gHAdvance\mapEntry by 1
\Write:File
   {|<url of jh keys file|>}%
   {<mapID target="indexentry-\mapEntry" 
             url="\RefFileNumber\FileNumber
       \#\title:chs {dx\last:haddr}{\cur:th\:currentlabel}%
           " />\Hnewline}%
>>>



\<jh defs\><<<
\AtBeginDocument{%
  \let\jh:toc=\auto:toc
  \expandafter\append:defI\csname tableofcontents*\endcsname{%
     \global\let\jh:toc=\auto:toc }%
}
>>>


\<load table of contents\><<<
\expandafter\ifx \csname jh:toc\endcsname\relax
   \tableofcontents
\else
   \expandafter\expandafter\expandafter\tableofcontents
   \expandafter\expandafter\expandafter[\csname
                                         jh:toc\endcsname]%
\fi
>>>

\<jh at end\><<<
\special{t4ht>|<url of jh keys file|>}%
\bgroup
   |<jh map for toc|>
  \bgroup \catcode`\:=12 \catcode`\@=12 \let\contentsname\empty
     |<load table of contents|>%
  \egroup
  \HCode {</map>\Hnewline}
\egroup
\special{t4ht*>|<url of jh keys file|>}%
\special{t4ht*>}%
>>>

\<jh map for toc\><<<
\Configure{Link}{mapID}{target="\sectioningKey-\TocCount" url=}{}{}
\Configure{TocLink}{\Link{#2}{}\EndLink}
\let\jh:doTocEntry\:doTocEntry
\def\:doTocEntry#1{%
   \edef\sectioningKey{\expandafter\gob:IV\string#1}%
   \edef\:temp{\noexpand\ConfigureToc{\sectioningKey}
               {}{\relax}{}{}}\:temp
   \jh:doTocEntry#1}
\def\gob:IV#1#2#3#4{}
\def\sectioningKey{NoToc}
>>>





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The JavaHelp TOC (jobname-jht.xml)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<url of jh toc file\><<<
\jobname-jht.xml>>>


\<jh toc\><<<
\bgroup
|<jh TOC config|>
|<start jh TOC|>
     |<load table of contents|>%
|<end jh TOC|>
\egroup
>>>

\<start jh TOC\><<<
\IgnorePar\par\leavevmode\special{t4ht>|<url of jh toc file|>}%
\begin{dito}-\
<?xml version="1.0" encoding="ISO-8859-1" ?>
\end{dito}
|<toc DTD|>
\begin{dito}-\
<!-\relax- |<tex4ht note|> -\relax->
<toc version="\dotVersion">
  <tocitem target="|<entry point|>" text="|<title label|>|<uni sp|>">
\end{dito}
\let\end:jhhook=\empty
\catcode`\:=12 \catcode`\@=12  \let\contentsname\empty
>>>

\<end jh TOC\><<<
\catcode`\:=11 \catcode`\@=11
\end:jhhook
\begin{dito}
  </tocitem>
</toc>
\end{dito}
\special{t4ht<|<url of jh toc file|>}
>>>



\<jh TOC config\><<<
\Configure{TocLink}
   {\HCode{<tocitem target="\sectioningKey-\TocCount"\Hnewline\space
                                       text="}#4\HCode{|<uni sp|>">\Hnewline}}
\let\jh:doTocEntry\:doTocEntry
\def\:doTocEntry#1{%
   \edef\sectioningKey{\expandafter\gob:IV\string#1}%
   \edef\:temp{\noexpand\ConfigureToc{\sectioningKey}
       {}{\noexpand\set:endtocitem{\sectioningKey}}{}{}}\:temp
   \jh:doTocEntry#1}
\def\gob:IV#1#2#3#4{}
\def\sectioningKey{NoToc}
>>>



\<jh util\><<<
\def\set:endtocitem#1{%
   \csname catchAt:#1\endcsname
   \expandafter\ifx\csname a:end#1\endcsname\relax
      \HCode{</tocitem>}%
   \else
      \expandafter\ifx \csname jh:#1\endcsname\relax
         |<end tocitem at end of toc|>%
         \def\:tempc##1,{\if ,##1,%
               \expandafter\gob:pardel
            \else              
               |<end tocitem at toc entry of diff type|>%
               \expandafter\:tempc
            \fi}%
         \expandafter\expandafter\expandafter
             \:tempc\csname a:end#1\endcsname,,|<par del|>%
      \fi
      |<end tocitem at toc entry of same type|>%   
   \fi
}
\def\gob:pardel#1|<par del|>{}
>>>


\<end tocitem at toc entry of same type\><<<
\csname jh:#1\endcsname
\expandafter\gdef\csname jh:#1\endcsname{%
   \expandafter\global\expandafter\let\csname jh:#1\endcsname=\empty
   \HCode{</tocitem><!--/#1-->}}%
>>>

\<end tocitem at toc entry of diff type\><<<
\expandafter\ifx \csname catchAt:##1\endcsname \relax
  \expandafter\gdef\csname 
    catchAt:##1\endcsname{\csname jh:#1\endcsname}%
\else
  \expandafter\pend:def\csname 
    catchAt:##1\endcsname{\csname jh:#1\endcsname}%
  \expandafter\global\expandafter\let\csname 
    catchAt:##1\expandafter\endcsname\csname catchAt:##1\endcsname
\fi
>>>


\<end tocitem at end of toc\><<<
\append:def\end:jhhook{%
   \csname jh:#1\endcsname
   \expandafter\global\expandafter
               \let\csname jh:#1\endcsname\:UnDef}%
\global\let\end:jhhook\end:jhhook
>>>




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{The JavaHelp Index (jobname-jhi.xml)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\<url of the jh index\><<<
\jobname-jhi.xml>>>

\<jh index\><<<
\bgroup
|<jh IDX config|>
|<start jh IDX|>
     |<load index entries|>%
|<end jh IDX|>
\egroup
>>>


\<start jh IDX\><<<
\IgnorePar\par\leavevmode\special{t4ht>|<url of the jh index|>}%
\begin{dito}-\
<?xml version="1.0" encoding="ISO-8859-1" ?>
\end{dito}
|<index DTD|>
\begin{dito}-\
<!-\relax- |<tex4ht note|> -\relax->
<index version="\dotVersion">
\end{dito}
>>>

\<end jh IDX\><<<
\begin{dito}
</index>
\end{dito}
\special{t4ht<|<url of the jh index|>}%
>>>


\<load index entries\><<<
\def\beforeindex#1||LNK#2#3{#1}%
\def\indexentry#1#2{\HCode{<indexitem target="indexentry-#2" 
                     text="}\beforeindex#1\HCode{|<uni sp|>" />\Hnewline}}%
\immediate\openin15=\jobname.4dx
\ifeof15 
   \immediate\closein15
\else
   \immediate\closein15
   \input \jobname.4dx
\fi
>>>


\<jh defs\><<<
\HAssign\indexEntry=0
\append:defI\@wrindex{%
   |<add index entry to map|>%
}
>>>


JavaHelp has problems with unicode values at the end of text fields in
the toc of within the jht file: it refuses `\verb+text="Men&#252;"+'
(but accepts `\verb+text="Men&#252; "+'). The following adds spaces at
the end of the text attribute values.

\<uni sp\><<<
 >>>

A similar problem occurs when two unicode character codes follow each
other. In this case, the second one is not properly rendered.


% 
% \<jh at start\><<<
% \Write:File
%    {|<url of the jh index|>}
%    {|<index preamble|>}
% >>>
% 
% 
% \<jh at end\><<<
% \Write:File
%    {|<url of the jh index|>}
%    {|<index postamble|>}
% >>>
% 
% \<index preamble\><<<
% <?xml version="1.0" encoding="ISO-8859-1" ?>\Hnewline
% |<old index DTD|> \Hnewline
% <!-- |<tex4ht note|> -->\Hnewline
% <index version="\dotVersion">\Hnewline
% >>>
% 
% \<index postamble\><<<
% </index>
% >>>
% 
% 
% \<jh defs\><<<
% \HAssign\indexEntry=0
% \append:defI\@wrindex{%
%    |<add index entry to map|>%
%    |<add index entry to index|>%
% }
% >>>
% 
% 
% \<add index entry to index\><<<
% \gHAdvance\indexEntry by 1
% \Write:File
%    {|<url of the jh index|>}%
%    {<indexitem target="indexentry-\indexEntry" 
%                      text="#1" />\Hnewline}%
% >>>
 



%%%%%%%%%%%%%
\subsection{Version Information}
%%%%%%%%%%%%%



\<helpset DTD\><<<
\begin{dito}-\
    <!DOCTYPE helpset PUBLIC 
    "-//Sun Microsystems Inc.//DTD JavaHelp HelpSet Version \dotVersion//|<dtd lang|>"
    "http://java.sun.com/products/javahelp/helpset_\subVersion.dtd">
\end{dito}
>>>

\<toc DTD\><<<
\begin{dito}-\
   <!DOCTYPE toc PUBLIC 
   "-//Sun Microsystems Inc.//DTD JavaHelp TOC Version \dotVersion//|<dtd lang|>" 
   "http://java.sun.com/products/javahelp/toc_\subVersion.dtd">
\end{dito}
>>>

\<index DTD\><<<
\begin{dito}-\
   <!DOCTYPE index PUBLIC
   "-//Sun Microsystems Inc.//DTD JavaHelp Index Version \dotVersion//|<dtd lang|>"    
   "http://java.sun.com/products/javahelp/index_\subVersion.dtd">
\end{dito}
>>>


\<old index DTD\><<<
   <!DOCTYPE index PUBLIC
   "-//Sun Microsystems Inc.//DTD JavaHelp Index Version \dotVersion//|<dtd lang|>"    
   "http://java.sun.com/products/javahelp/index_\subVersion.dtd">
>>>





\<map DTD\><<<
<!DOCTYPE map PUBLIC\Hnewline
     "-//Sun Microsystems Inc.//DTD
                    JavaHelp Map Version \dotVersion//|<dtd lang|>"\Hnewline
     "http://java.sun.com/products/javahelp/map_\subVersion.dtd">  >>>


\<jh defs\><<<
\:CheckOption{jh1.0} \if:Option
   \def\dotVersion{1.0}
   \def\subVersion{1\string_0}
\else
   \def\dotVersion{2.0}
   \def\subVersion{2\string_0}
\fi
>>>







%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Incorporate JavaHelp into a program}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Url of JavaHelp root file (jobname.jh)

\url{http://supportweb.cs.bham.ac.uk/documentation/tutorials/docsystem/build/tutorials/javahelp/javahelp.html}


\<program\><<<
import java.net.URL;
import javax.help.*;
import javax.swing.*;
public class program {
           //^^^^^^^
   public static void main(String args[]) {
      JHelp helpViewer=null;
      try {
         ClassLoader cl = program.class.getClassLoader();
                        //^^^^^^^
         URL url = HelpSet.findHelpSet(cl, 
                              "|<url of jh root file|>");
         HelpSet hs = new HelpSet(cl, url);
         helpViewer = new JHelp( hs );
         /*
            helpViewer.setCurrentID("|<entry point|>");
         */
      } catch (Exception e) { 
          System.out.println("error"); System.exit(0); 
      }
      JFrame frame = new JFrame();
      frame.getContentPane().add(helpViewer);
      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame.setSize(500,500);
      frame.setVisible(true);
   }
}
>>>











%%%%%%%%%%%%%%%%%%%%%
\subsection{Compiling}
%%%%%%%%%%%%%%%%%%%%%

\def\JAVAC{javac -classpath \JHDIR jh1.1.3/javahelp/lib/jh.jar program.java}

Add JavaHelp to your program, say `program.java', and compile the
program with the command `{\tt \JAVAC}'.



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Running}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\RUN{java -classpath \JHDIR jh1.1.3/javahelp/lib/jh.jar;. program}

Use the a command similar to  `{\tt \RUN}'.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Compressing (with JAR)}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%





\begin{verbatim}
javac -classpath c:\jh1.1.3\javahelp\lib\jhall.jar
      -d c:\temp
      JavaHelpTest.java 

jar cvfm JavaHelpTest.jar  manifest JavaHelpTest.class

java -jar jh1.3.1/demos/bin/UserGuide.jar 
\end{verbatim}






%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Getting the JavaHelp Software}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


Download JavaHelp from 
      \url{http://java.sun.com/products/javahelp/download_binary.html}
and unzip it into some directory (say {\tt \JHDIR}).


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Sample}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Help Set}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\verbatiminput{\jobname.hs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Map Files}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\verbatiminput{\jobname.jhm}   


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Table of Contents}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\verbatiminput{\jobname-jht.xml}  


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Index}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\verbatiminput{\jobname-jhi.xml}   
%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\OutputCodE\<javahelp.4ht\>
\OutputCodE\<javahelp-a.4ht\>

\ifOption{javahelp}
   {}
   {
    \Needs{"xhlatex \jobname\space \string\"html,3,javahelp\string\""}
    \Needs{"xhlatex \jobname\space \string\"html,3,javahelp\string\""}
   }

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%







