JAVA2HTML(1)
π JAVA2HTML π
okay bestie, pull up a chair, because this is the java2html manual page from the General Commands Manual and we are about to make highlighted source code look stunning. π
β¨ NAME β¨
java2html β generates highlighted html-files from Java or C++ source. no cap, that's the whole job and it does it gorgeously. π
πΈ SYNOPSIS πΈ
java2html [options] [filename...]
π¦ DESCRIPTION π¦
This manual page documents how to use java2html. So here's the tea, bestie: if you give java2html no arguments at all on the command line, it reads from stdin and writes to stdout. classic pipes-and-vibes situation. π«Ά
But if you invoke it with filenames as arguments, java2html will write its output into new files. Names of output files are generated by appending .html to the corresponding input filename. so Foo.java becomes Foo.java.html and honestly? slay. β¨
π§ Installing as a CGI program π§
java2html can be installed as a CGI program and convert source files on the fly. In order to set this up for apache the webmaster has to add the two lines
AddType text/x-java .java
Action text/x-java /cgi-bin/java2html
to the webserver configuration file. heads up though: java2html depends on the webserver properly setting environment variable PATH_TRANSLATED to the pathname of the source file. If java2html has been compiled with option -DCOMPRESSION=1 then it will invoke gzip to compress the generated HTML before sending it to the requesting browser. Of course java2html takes care to check if the browser accepts gzip encoding β it's polite like that. π
π OPTIONS π
--β Interpret all following arguments on the command line as filenames. This is useful, if you want to convert files beginning with a-. (yes, the dash-files. we see them. we support them.) π©·-bfilename β Insert the file filename after converted data and before HTML footer. See also the-soption.-cβ Turns off CGI-script detection and HTTP header generation. This is needed to usejava2htmlas a subcommand in another CGI script. lowkey essential for nesting. πͺΊ-hfilename β Insert the file filename after the HTML headers and before the converted data. See also the-soption.-iβ Generate an index only. This will generate a list of references (HREF's) to the labels thatjava2htmlcreates for your source file. The references are created as list items (<li>) in an HTML list. Each line has the form
<li><a href="#name">prototype()</a></li>
so they can be used directly as an index list, or further parsed by another script.
If you want the index at the top of the source file, you will need a wrapper script like this one:
#! /bin/sh
echo "Content-type: text/html"
echo ""
echo "<html>"
echo "<head><title>$PATH_TRANSLATED</title>"
echo "<meta name=\"generator\""
echo "content=\"`java2html -V`\">"
echo "</head>"
echo "<body>"
echo "<h1>Source of $PATH_TRANSLATED</h1>"
echo "<ul>Structures and functions"
cat $PATH_TRANSLATED | java2html -isc
echo "</ul>"
echo "<hr></hr>"
cat $PATH_TRANSLATED | java2html -sc
echo "</body></html>"
exit
-nβ Number lines and label them with'line'followed by the line number. Empty lines get no label, but the linecounter will count them nevertheless. With this feature you can refer to special lines of code from other parts of the generated file or from external files with a line like this:
<A HREF="foo.java.html#line301">Go to line 301</A>
it's giving jump to the exact line energy and we're obsessed. π₯
-sβ With this option you can suppress the generation of HTML headers. This is especially useful together with options-bfile and-hfile.-ttitle β Set the title to title. The default is the filename you converted or"stdin"if reading from stdin. This option is only used if-sis not set.-uβ Print usage information.-wwidth β sets theWIDTHattribute for HTML tag<PRE>. If this option is not used a default of80is assumed. (Currently most browsers are ignoring this attribute). π the disrespect honestly-Vβ reports the version number ofjava2html.
π EXIT STATUS π
java2html returns:
0on success π1if input files are not existing/readable2if output files are not creatable/writable3if invoked with illegal options4ifgzipcannot be invoked
so if something goes wrong you will know which something it was. no mystery. periodt. π
π«Ά AUTHORS π«Ά
- Florian Schintke
<schintke@cs.tu-berlin.de> - Martin Kammerhofer
<mkamm@gmx.net>wrote the CGI feature. - Rob Ewan
<rob@ewan.com>wrote the indexing feature.
icons. legends. the blueprint. π
π SEE ALSO π
c2html(1), pas2html(1), perl2html(1).
ok that's the whole page bestie, every flag, every exit code, every author, all of it β nothing skipped, nothing invented, fr fr. πΈ
and that's a wrap on the JAVA2HTML(1) page from the General Commands Manual β go forth and highlight something gorgeous. πβ¨π
π¦ where this page comes from
- debian bookworm: java2html 0.9.2-7+b1
- debian trixie: java2html 0.9.2-7+b1
- ubuntu jammy: java2html 0.9.2-7
- ubuntu noble: java2html 0.9.2-7
- ubuntu resolute: java2html 0.9.2-7build1
- ubuntu stonking: java2html 0.9.2-7build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms