Comment convertir le code source Java en page HTML

Comment convertir le code source Java en page HTML

Java2HTML est un outil pour convertir le code source Java en une page HTML colorisée et navigable, et les étapes sont assez simples.

Étapes pour le convertir

1) Télécharger Java2HTML -http://www.java2html.com/download.html

2) Décompressez-le, par exemple «D: \ Java2HTML»

3) Editez le fichier «j2h.bat» et modifiez la variable CLASSPATH. Assurez-vous qu'il pointe vers la bibliothèque j2h.jar appropriée.

@echo off
REM Change this Script, to suit your needs

REM The next few line combines the command line args into one
set _j2h_parameter=
:GetParameter
if "%1" == "" goto end
set _j2h_parameter=%_j2h_parameter% "%1"
shift
goto GetParameter
:end

REM runs Java2HTML
set MBACKUP=%CLASSPATH%
set CLASSPATH=D:\Java2HTML\j2h.jar;%CLASSPATH%
java j2h %_j2h_parameter%
set CLASSPATH=%MBACKUP%

4) Définissez le «j2h» dans la variable d'environnement Windows. (Si vous avez besoin d'accéder à la commande globalement)

5) Émettez la commande suivante

C:\>j2h -js D:\Java2HTML\source -d D:\Java2HTML\output

D:\Java2HTML\source is the Java source code to convert
D:\Java2HTML\output is the generated HTML output folder

Résultat

- Voici un exemple pour convertir tous les codes source TestNG en pages HTML.

C:\>j2h -js D:\Java2HTML\source -d D:\Java2HTML\output
Java2HTML Version 1.5
Copyright (c) 1999-2007, Enterprise Solution Consultants Limited, All Rights Reserved.
New Versions available from http://www.java2html.com
(type j2h with no arguments to get help)
Created D:\Java2HTML\output\stylesheet.css
Created D:\Java2HTML\output\front.html
Created: D:\Java2HTML\output\org\testng\internal\Invoker.java.html
Created: D:\Java2HTML\output\org\testng\ClassMethodMap.java.html
Created: D:\Java2HTML\output\org\testng\v6\TestPlan.java.html
Created: D:\Java2HTML\output\org\testng\annotations\Test.java.html
Created: D:\Java2HTML\output\org\testng\internal\annotations\JDK14TagFactory.java.html
Created: D:\Java2HTML\output\org\testng\annotations\AfterMethod.java.html
Created: D:\Java2HTML\output\org\testng\internal\TestMethodWorker.java.html
Created: D:\Java2HTML\output\org\testng\JUnitConverter.java.html
Created: D:\Java2HTML\output\org\testng\internal\BaseClassFinder.java.html
Created: D:\Java2HTML\output\org\testng\internal\AnnotationTestConverter.java.html
Created: D:\Java2HTML\output\org\testng\junit\JUnitDirectoryConverter.java.html
Created: D:\Java2HTML\output\org\testng\JUnitConverterTask.java.html
Created: D:\Java2HTML\output\org\testng\remote\strprotocol\GenericMessage.java.html
Created: D:\Java2HTML\output\org\testng\xml\ClassSuite.java.html
Created: D:\Java2HTML\output\org\testng\internal\thread\ThreadTimeoutException.java.html
Created: D:\Java2HTML\output\org\testng\internal\BaseTestMethod.java.html
Created: D:\Java2HTML\output\org\testng\annotations\TestInstance.java.html