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

编程知识 行业动态 更新时间:2024-06-13 00:17:59

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

转换步骤

1)下载Java2HTML – http://www.java2html/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
(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
标记: HTML Java 源代码

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

更多推荐

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

本文发布于:2023-03-26 02:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/a71b62d795ba8cc19604cffb9a7475ae.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:转换为   如何将   源代码   页面   Java

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!