summaryrefslogtreecommitdiff
path: root/support/TeX4ht/doc/jhsample.tex
blob: c17e002d6a78da09f1175cd91568b7999c2e6499 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
\documentclass{article}

  \usepackage{url}
  \Configure{ProTex}{java,<<<>>>,title,`,list,[[]]}

  \usepackage{makeidx}
  \makeindex

\begin{document}

\tableofcontents

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Compilation Instructions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{itemize}
\item
Compile this \LaTeX{} file with the
\index{jhlatex}%
`{\tt jhlatex
jobname "html,3"}'
command.
\item
\index{JavaHelp URL}%
The URL into the javahelp file, as provided by tex4ht, is
`{\tt jobname-doc/jobname-jh.xml}'.
\item
The java programs should be compiled with commands  similar to
\index{javac}%
`{\tt javac -classpath
  \$\string{HOME\string}/jh2.0/javahelp/lib/jh.jar program.java}'.
\item
The programs should run with commands similar to
\index{java}%
`{\tt java -classpath
  \$\string{HOME\string}/jh2.0/javahelp/lib/jh.jar:. program}'.
\end{itemize}




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

\<jhprog\><<<
import java.net.URL;
import javax.help.*;
import javax.swing.*;
public class jhprog {
   public static void main(String args[]) {
      JHelp helpViewer=null;
      try {
         ClassLoader cl = jhprog.class.getClassLoader();
         URL url = HelpSet.findHelpSet(cl,
                              "`jobname-doc/`jobname.hs");
         helpViewer = new JHelp(new HelpSet(cl, url));
      } catch (Exception e) { System.out.println("error");
      }
      JFrame frame = new JFrame();
      frame.setSize(500,500);
      frame.getContentPane().add(helpViewer);
      frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
      frame.setVisible(true);
   }
}
>>>

\OutputCode\<jhprog\>


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

A source file \edef\temp{\noexpand\url{jhsample.tex}}\temp{} of this
document  may be compiled for JavHelp 2.0 with the following script.

\Verbatim
jhlatex jhsample
tex "\def\filename{{$1}{idx}{4dx}{ind}} \input  idxmake.4ht"
makeindex -o jhsample.ind jhsample.4dx
jhlatex jhsample
\EndVerbatim

The compilation produces the following files.

\begin{verbatim}
jhprog.class
jhsample-doc/
jhsample-doc/jhsample.html
jhsample-doc/jhsample.jhm
jhsample-doc/jhsample-jhi.xml
jhsample-doc/jhsample.hs
jhsample-doc/jhsample-jht.xml
jhsample-doc/jhprog.java
\end{verbatim}


The following instruction can be used for compiling the program.

\Verbatim
javac -classpath ${HOME}/jh2.0/javahelp/lib/jh.jar jhprog.java
\EndVerbatim


The outcome could be viewed through the following command.

\Verbatim
java -cp ${\home}/jh2.0/javahelp/lib/jh.jar:. jhprog
\EndVerbatim


\printindex

\end{document}