如何将Java源代码转换为HTML页面

Java2HTML是将Java源代码转换为彩色和可浏览HTML页面的工具,其步骤非常简单。

转换步骤

1)下载Java2HTML – http://www.java2html.com/download.html

2)解压缩,例如“ D:\ Java2HTML”

3)编辑“ j2h.bat”文件并修改CLASSPATH变量。 确保它指向正确的j2h.jar库。

@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)将“ j2h”设置为Windows环境变量。 (如果需要全局访问该命令)

5)发出以下命令

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

D:\ Java2HTML \ source是要转换的Java源代码
D:\ Java2HTML \ output是生成的HTML输出文件夹

结果

–这是将所有TestNG源代码转换为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

翻译自: https://mkyong.com/java/how-to-convert-java-source-code-to-html-page/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值