将 .jar 文件转换为 JAVA DOC
如何将我的 jar 文件放到 web.xml 上?即有没有一个软件可以反编译jar文件并制作html页面? 换句话说,我想制作一个java文档。
How can I put my jar file to web. i.e is there a software that decompile jar file and make html pages of it?
In other words I want to make a java doc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
[根据用户评论编辑]
所以你想从jar中提取javadoc...
首先你必须明白,如果你的jar不包含源代码,而只包含编译后的代码,那么你的javadoc将不会显示任何注释。
然后,您只需使用任何 zip 程序提取 jar 中的文件(例如,在 Windows 上,将文件重命名为 .zip,然后提取它)。
最后要做的事情是调用 javadoc 工具。就像其他人所说的那样,您可以使用 IDE,或者只需从命令行调用:
http://download.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#examples
[Edit according to user comment]
So you want to extract javadoc from a jar...
First you must understand that if your jar doesn't contain the sources, but only the compiled code that your javadoc will not show any comment.
Then you just need to extract the file in your jar using any zip program (for exemple on windows, rename file to .zip, and extract it).
Last thing to do, is to call the javadoc tool on it. Like other said you can use an IDE for that, or simply call from the command line :
http://download.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#examples
据我所知,按照预期的方式创建 Javadoc 只能从源头进行。如果 JAR 文件还包含源文件,那么只需编写一个 Java 程序来打开 JAR 文件并通过 javadoc 实用程序放入任何源文件即可。
有趣的想法,但我目前不知道有什么可以做到这一点。据我所知,可以从 java 程序内部。
另一种方法是将类加载到类路径中,并使用反射来找出方法、字段等。它将为您提供类的粗略概述,但遗憾的是,它不会为您提供“正常”javadoc 生成提供的详细信息。编译时很多信息被丢弃。
Creating Javadoc the way it was intended works, as far as I know, only from sources. If the JAR file also contains the source files, then it's just a matter of writing a Java program that opens the JAR file and puts any source files through the javadoc utility.
Interesting idea, but I don't know of anything doing that at the moment. To my knowledge it is however possible to generate Javadoc from inside of java program.
Another approach would be to load the classes into your classpath and use reflection to figure out methods, fields, etc. It will give you a rough overview of the classes, but sadly not the detailed stuff "normal" javadoc generation gives you. A lot of information is discarded upon compilation.
将 .jar 文件转换为 html 似乎是不可能的,除非您打算让用户从网络下载 .jar 文件。但是,html 到 .jar 是可能的。
我确信只有java源代码可以转换为javadoc。请参阅此处将 java 源代码转换为 javadoc。
Converting .jar file to html seems impossible, except if you intend to users to download the .jar file from the web. However, html to .jar is possible.
I am certain that only the java source can be converted to javadoc. See here to convert java source to javadoc.
我从不是由您创建的 jar 文件创建了一个 JAVADOC ,即您没有其源代码。
它简单但棘手。
干杯
伊姆兰·塔里克
I have created a JAVADOC from a jar file that is not created by you i.e you don't have its source code.
Its simple but tricky.
Cheers
Imran Tariq
下载 APK 文件后,您需要执行以下步骤来获取可编辑的 java 代码/文档。
使用
保存
选项,只需选择另存为
并提及您的扩展名为 .zip)通过这样做,您可以避免 APKTOOL...
现在我们需要转换 dex -> .class
此处,解压后,在
命令提示符你必须提到,
[此处](请记住,您的 somefilename.dex 必须位于您所在的同一文件夹内
保留你的 dex2jar。)
http://www.viralpatel.net/blogs/download/jad/jad.zip 和
提取它。解压后,您可以看到两个文件,例如“jad.exe”和
“Readme.txt”(有时可能是“jad.txt”而不是“jad.exe”,所以
只需将其扩展名重命名为.exe 即可运行)
-sjava yourfilename.class] 它将把你的类文件解析成可编辑的java文档。
Once you downloaded your APK file , You need to do the following steps to get a editable java code/document.
with
save
option , just go withsave as
and mention yourextension as .zip) by doing like this you may avoid APKTOOL...
now we need to convert dex -> .class
dex2jar
(you can download it fromhere , after extracted, in
command prompt you have to mention like,
[here] (Keep in mind that your somefilename.dex must be inside the same folder where you
have keep your dex2jar.)
http://www.viralpatel.net/blogs/download/jad/jad.zip and
extract it. Once extracted you can see two files like "jad.exe" and
"Readme.txt" (sometimes "jad.txt" may there instead of "jad.exe", so
just rename its extension as.exe to run)
-sjava yourfilename.class] it will parse your class file into editable java document.
在 Maven 中使用
mvn javadoc:javadoc
。Use
mvn javadoc:javadoc
in Maven.