Xref-Java2Html — 很好用的java2html工具
Xref-Java2Html生成的超链接最多,方便在浏览器中阅读代码,跳转也非常方便。
其它的一些java2hhtml的工具,只能算是语法高亮的html,
缺少class之间关联跳转的链接,使得阅读代码并不方便。
Xref-Java2Html的安装步骤为:
1.运行 java -jar xref-java2html-i86pc-windows.jar,选择安装目录:
比如我选的 d:\java\xref-java2html,安装完成。
2.再到D:\Java\xref-java2html下面运行 java -jar java2html.jar
D:\Java\xref-java2html>java -jar java2html.jar
3.在界面中,添加需要生成html的java源代码的目录,
点“Options” 设置参数:
把Generate .html files instead of .java.html的钩去掉.
实际最终生成html是xrefw.exe这个程序执行的结果
D:\Java\xref-java2html>xrefw.exe -java2html -stderr -html -nostdop -nocxfile -javafilesonly -mf20 -htmlgxlist -htmllxlist -htmldirectx -refalphahash -htmllinenums -htmlcutsuffix -htmlgenjavadoclinks -htmllinenumlabel=line. -jdkclasspath D:\Java\jdk1.6.0_03\jre\lib\rt.jar -classpath C:\ -javadocpath C:\ -sourcepath D:\ -d “E:\mywork\minasmpp\java2html” “E:\mywork\minasmpp\src” -htmljavadocpath=http://download.--escaped_anchor:330b518f285a7a54651177f07dbabf01--.net/jdk/jdk-api-localizations/jdk-api-zh-cn/publish/1.6.0/html/zh_CN/api
官方网站只提供了1.4版本的可执行文件。
因此需要自己编译1.6.10的代码。
(我用cygwin编译成功,但是只能在cygwin下运行)
编译步骤如下:
1.安装cygwin. 我安装的是: cygwinenv-2.00.exe
安装到D:\cygwin
2.解压代码到D:\cygwin\xrefactory-1.6.10-src
3.启动cygwin,转到对应目录,执行make
—————-
Copying skeleton files.
These files are for the user to personalize
their cygwin experience.
These will never be overwritten.
`./.bashrc’ -> `/home/Administrator//.bashrc’
`./.bash_profile’ -> `/home/Administrator//.bash_profile’
`./.inputrc’ -> `/home/Administrator//.inputrc’
Administrator@lizongbo ~
$ ls
Administrator@lizongbo ~
$ cd /
Administrator@lizongbo /
$ ls
bin cygwin.ico home tmp var
cygwin.bat etc lib usr xrefactory-1.6.10-src
Administrator@lizongbo /
$ cd xrefactory-1.6.10-src/
Administrator@lizongbo /xrefactory-1.6.10-src
$ ls
byacc-1.9 xref-any
Administrator@lizongbo /xrefactory-1.6.10-src
$ cd xref-any/
Administrator@lizongbo /xrefactory-1.6.10-src/xref-any
$ make
sh CreateXrefDistribution
make[1]: Entering directory `/xrefactory-1.6.10-src/xref-any/src’
make -C ../lib/zlib libz.a
make[2]: Entering directory `/xrefactory-1.6.10-src/xref-any/lib/zlib’
cc -O -c -o adler32.o adler32.c
cc -O -c -o compress.o compress.c
cc -O -c -o crc32.o crc32.c
cc -O -c -o gzio.o gzio.c
cc -O -c -o uncompr.o uncompr.c
cc -O -c -o deflate.o deflate.c
cc -O -c -o trees.o trees.c
cc -O -c -o zutil.o zutil.c
cc -O -c -o inflate.o inflate.c
cc -O -c -o infblock.o infblock.c
cc -O -c -o inftrees.o inftrees.c
cc -O -c -o infcodes.o infcodes.c
cc -O -c -o infutil.o infutil.c
cc -O -c -o inffast.o inffast.c
ar rc libz.a adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o zut
il.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o
make[2]: Leaving directory `/xrefactory-1.6.10-src/xref-any/lib/zlib’
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o cgram.o cgram.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o main.o main.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o globals.o globals.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o misc.o misc.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o semact.o semact.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o commons.o commons.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o generate.o generate.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o enumTxt.o enumTxt.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o complet.o complet.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o cxref.o cxref.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o cxfile.o cxfile.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o lex.o lex.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o yylex.o yylex.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o cexp.o cexp.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o options.o options.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o caching.o caching.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o javagram.o javagram.c
In file included from y.tab.c:2465:
recyacc.h:20:1: warning: “yylval” redefined
../../src/javagram.y:8:1: warning: this is the location of the previous definiti
on
recyacc.h:21:1: warning: “yydebug” redefined
../../src/javagram.y:21:1: warning: this is the location of the previous definit
ion
recyacc.h:22:1: warning: “yynerrs” redefined
../../src/javagram.y:22:1: warning: this is the location of the previous definit
ion
recyacc.h:23:1: warning: “yyerrflag” redefined
../../src/javagram.y:23:1: warning: this is the location of the previous definit
ion
recyacc.h:24:1: warning: “yychar” redefined
../../src/javagram.y:24:1: warning: this is the location of the previous definit
ion
recyacc.h:25:1: warning: “lastyystate” redefined
../../src/javagram.y:25:1: warning: this is the location of the previous definit
ion
recyacc.h:26:1: warning: “yyssp” redefined
../../src/javagram.y:26:1: warning: this is the location of the previous definit
ion
recyacc.h:27:1: warning: “yyval” redefined
../../src/javagram.y:27:1: warning: this is the location of the previous definit
ion
recyacc.h:28:1: warning: “yyss” redefined
../../src/javagram.y:28:1: warning: this is the location of the previous definit
ion
recyacc.h:29:1: warning: “yyvs” redefined
../../src/javagram.y:29:1: warning: this is the location of the previous definit
ion
recyacc.h:30:1: warning: “yyvsp” redefined
../../src/javagram.y:31:1: warning: this is the location of the previous definit
ion
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o jsemact.o jsemact.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o cfread.o cfread.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o cct.o cct.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o init.o init.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o editor.o editor.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o refactory.o refactory.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o yaccgram.o yaccgram.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o html.o html.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o extract.o extract.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o classh.o classh.c
gcc -c -O -I../src -I../lib/zlib -I. -DDEBUG -DUSE_LIBZ -DBIN_RELEASE -DPRESERVE
_C_ARGS -D__mygnulinux__ -c -o jslsemact.o jslsemact.c
gcc -o xref cgram.o main.o globals.o misc.o semact.o commons.o generate.o enumT
xt.o complet.o cxref.o cxfile.o lex.o yylex.o cexp.o options.o caching.o javagra
m.o jsemact.o cfread.o cct.o init.o editor.o refactory.o yaccgram.o html.o extra
ct.o classh.o jslsemact.o ../lib/zlib/libz.a
echo -e “\n\t\t\t\tnormal end of make\n”
normal end of make
make[1]: Leaving directory `/xrefactory-1.6.10-src/xref-any/src’
cp: `src/xref’ and `../xref/xref’ are the same file
Administrator@lizongbo /xrefactory-1.6.10-src/xref-any
$
—————-
4.将D:\cygwin\xrefactory-1.6.10-src\xref下的xref.exe 复制到D:\cygwin\
(不复制到这里的话,会出现目录找不到的情况,导致html生成不了)
4.将要转换出html的java代码复制到D:\cygwin\下面
(cygwin 中 /docs/sms/src对应windows下的 D:\cygwin\docs\sms\src)
5.运行xref.exe
Administrator@lizongbo /
$ cd /
Administrator@lizongbo
$ xref -java2html -stderr -html -nostdop -nocxfile -javafilesonly -mf20 -htmlgxlist -htmllxlist -htmldirectx -refalphahash -htmllinenums -htmlcutsuffix -htmlgenjavadoclinks -htmllinenumlabel=line. -jdkclasspath D:\Java\jdk1.6.0_03\jre\lib\rt.jar -d “/docs/sms/java2html” “/docs/sms/src” -htmljavadocpath=http://download.--escaped_anchor:330b518f285a7a54651177f07dbabf01--.net/jdk/jdk-api-localizations/jdk-api-zh-cn/publish/1.6.0/html/zh_CN/api
html就全部生成了。
将java的源代码拿来生成在线查看。
xref -java2html -stderr -html -nostdop -nocxfile -javafilesonly -mf20 -htmlgxlist -htmllxlist -htmldirectx -refalphahash -htmllinenums -htmlcutsuffix -source 1.4 -htmlgenjavadoclinks -htmllinenumlabel=line. -jdkclasspath D:\Java\jdk1.6.0_03\jre\lib\rt.jar -d “/docs/java” “/docs/javasrc” -htmljavadocpath=http://618119.com/docs/--escaped_anchor:330b518f285a7a54651177f07dbabf01--/java2html
不过根据生成的代码来看,
页面最下方显示的还是: Html form generated by Xref-Java2Html version 1.4.0
貌似被1.6.10忽悠了。
相关下载资源:
Xref-Java2Html:
http://www.xref-tech.com/--escaped_anchor:2e1085c046790a8961c7ea9c1d8e222b--/main.html
http://www.xref-tech.com/xrefactory/ftp/xref---escaped_anchor:2e1085c046790a8961c7ea9c1d8e222b---i86pc-windows.jar
http://www.xref-tech.com/xrefactory/ftp/xref---escaped_anchor:2e1085c046790a8961c7ea9c1d8e222b---i86pcWindows.zip
http://www.xref.sk/xrefactory---escaped_anchor:330b518f285a7a54651177f07dbabf01--/main.html
src-highlite:
http://jaist.dl.sourceforge.net/sourceforge/gnuwin32/src-highlite-2.1.2.exe
java2html:
http://java2html.de/
http://www.--escaped_anchor:2e1085c046790a8961c7ea9c1d8e222b--.de/java2html_50.zip
The Java2HTML Tool:
http://www.--escaped_anchor:2e1085c046790a8961c7ea9c1d8e222b--.com/
http://www.--escaped_anchor:2e1085c046790a8961c7ea9c1d8e222b--.com/Java2HTML.zip