Download Java2HTML Now Advanced EJB design & refactoring
for quick & easy J2EE development

The Java2HTML Tool



Java2HTML is a simple-to-use open-source tool which converts a bunch of Java Source Code into a colourized and browsable HTML representation. Go to download (Version 1.5.1) to get the tool now and/or see some example outputs. You must read the License Agreement before downloading this software.

Java2HTML is used by thousands of organizations to publish their source code on the internet, including  Sun Microsystems (Java Pet Store Demo 1.3.2) and Oracle ( LOBSample).

Java2HTML is open source hosted on SourceForge. Please get involed.

Feature List

Main features include:-


Java2HTML can be used from within Ant. View the Java2HTML Task documentation to see  how to do this.


Java2HTML can be used from within a Java program by using the Java2HTML API . This is only available in 1.3Beta onwards. 

View the Java2HTML API example to see how to use it.


Installing, assumes a certain level of technical knowledge.



Type, " j2h" (if using the script) with no arguments to get a list of options.

Option aka Default Description
-d <directory> -destination output Specifies the HTML output directory.
-js <directory> -javasource current directory Specifies the Java Source directory that will be converted to HTML. Repeat for each Java Source directory.
-jd <directory> [web_reference] -javadoc N/A Used to specify JavaDoc directories that the generated HTML will link to. Specify the optional extra parameter [web_reference] to indicate the web address if the Java HTML is to be accessed from a web server.
-m -margin 0 Margin size, with Line Numbers.
-t -tab 4 The number of spaces that Tabs will be converted to.
-n -name Java Source Name used in the frames.
-h  -help, /? or j2h with no arguments N/A Display Help Options.
-nh -noheader false prevents the header from being displayed.
-nf -nofooter false prevents the footer from being displayed.
-s -simple false Simple output, just include the Java source and stylesheet.css files. Also package links will not be set within the source

In addition, Java2HTML will produce a "stylesheet.css", in the output directory which can be edited to change the colour or style scheme. (Warning: this will get overwritten if it already exists when you run j2h)

Example Usage

To review the output of running Java2HTML, view the index.html produced in the output directory with your favorite web browser.

I highly recommend the use of the -jd option. You will nearly always want to link into the standard Java libraries, so you will typically supply the following parameter, "-jd C:\JDK1.2\DOCS\API". Use the -jd option for each set of Java Doc you have access to.

Assuming you are using the Dos or Unix scripts "j2h.bat" or "j2h", type the examples for the specified effects.

Example Outputs

Examples are from the SUN Microsystems JDK 1.4 Demos. If you experience any problems whilst browsing these links, please email a description of the problem to

Note: These examples use the web_reference feature of the -jd option, to point the web documentation at the Sun Java website. It would be more typical in general use to point the web_reference at your own local copy of the documentation.

Known Limitations and Future Extensions

If you have any ideas or requests please check out the SourceForge Java2HTML Open Discussion Forum.



Please report bugs to, before emailing make sure that the bug is not listed in Known Limitations and Possible Extensions.

Change History


License Agreement

GNU General Public License Version 2



Java2HTML is distributed as free software but should a user or company make significant use of it, they are encouraged to make a $50 contribution which gives them registration status and helps towards future development costs. Please click on the following link.

last updated: October 20 2015