刚刚才想起来Java2HTML是一个Ant扩展.
打开Java2htmltask.java添加以下方法:public void setEncoding(String strEncoding){ O05.setEncoding(strEncoding);}在ant中就可以使用了.<!--build the online java code--> <taskdef name="java2html" classname="com.java2html.Java2HTMLTask" /> <target name="javacode" depends="javadoc"> <copy todir="${temp.dir}"> <fileset dir="${src.dir}"/> </copy> <java2html title="${project.name} Source Code Online View (${project.version})" simple="no" tabsize="4" marginsize="2" header="true" footer="true" encoding="${project.encoding}" destination="${web.code.dir}"> <fileset dir="${temp.dir}"> <include name="**/*.java" /> </fileset> <javadoc localRef="${web.doc.dir}" /> </java2html> </target>