Debian Codegraph @

texmf-dist/doc/generic/tex4ht/jhsample.tex

raw
1 \documentclass{article}
2
3 \usepackage{url}
4 \Configure{ProTex}{java,<<<>>>,title,`,list,[[]]}
5
6 \usepackage{makeidx}
7 \makeindex
8
9 \begin{document}
10
11 \tableofcontents
12
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 \section{Compilation Instructions}
15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
16
17 \begin{itemize}
18 \item
19 Compile this \LaTeX{} file with the
20 \index{jhlatex}%
21 `{\tt jhlatex
22 jobname "html,3"}'
23 command.
24 \item
25 \index{JavaHelp URL}%
26 The URL into the javahelp file, as provided by tex4ht, is
27 `{\tt jobname-doc/jobname-jh.xml}'.
28 \item
29 The java programs should be compiled with commands similar to
30 \index{javac}%
31 `{\tt javac -classpath
32 \$\string{HOME\string}/jh2.0/javahelp/lib/jh.jar program.java}'.
33 \item
34 The programs should run with commands similar to
35 \index{java}%
36 `{\tt java -classpath
37 \$\string{HOME\string}/jh2.0/javahelp/lib/jh.jar:. program}'.
38 \end{itemize}
39
40
41
42
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 \section{Sample Program}
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46
47 \<jhprog\><<<
48 import java.net.URL;
49 import javax.help.*;
50 import javax.swing.*;
51 public class jhprog {
52 public static void main(String args[]) {
53 JHelp helpViewer=null;
54 try {
55 ClassLoader cl = jhprog.class.getClassLoader();
56 URL url = HelpSet.findHelpSet(cl,
57 "`jobname-doc/`jobname.hs");
58 helpViewer = new JHelp(new HelpSet(cl, url));
59 } catch (Exception e) { System.out.println("error");
60 }
61 JFrame frame = new JFrame();
62 frame.setSize(500,500);
63 frame.getContentPane().add(helpViewer);
64 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
65 frame.setVisible(true);
66 }
67 }
68 >>>
69
70 \OutputCode\<jhprog\>
71
72
73 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 \section{Sample Script}
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76
77 A source file \edef\temp{\noexpand\url{jhsample.tex}}\temp{} of this
78 document may be compiled for JavHelp 2.0 with the following script.
79
80 \Verbatim
81 jhlatex jhsample
82 tex "\def\filename{{$1}{idx}{4dx}{ind}} \input idxmake.4ht"
83 makeindex -o jhsample.ind jhsample.4dx
84 jhlatex jhsample
85 \EndVerbatim
86
87 The compilation produces the following files.
88
89 \begin{verbatim}
90 jhprog.class
91 jhsample-doc/
92 jhsample-doc/jhsample.html
93 jhsample-doc/jhsample.jhm
94 jhsample-doc/jhsample-jhi.xml
95 jhsample-doc/jhsample.hs
96 jhsample-doc/jhsample-jht.xml
97 jhsample-doc/jhprog.java
98 \end{verbatim}
99
100
101 The following instruction can be used for compiling the program.
102
103 \Verbatim
104 javac -classpath ${HOME}/jh2.0/javahelp/lib/jh.jar jhprog.java
105 \EndVerbatim
106
107
108 The outcome could be viewed through the following command.
109
110 \Verbatim
111 java -cp ${\home}/jh2.0/javahelp/lib/jh.jar:. jhprog
112 \EndVerbatim
113
114
115 \printindex
116
117 \end{document}
118