将 .jar 文件转换为 JAVA DOC

发布于 2024-11-04 00:42:10 字数 79 浏览 1 评论 0原文

如何将我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

§对你不离不弃 2024-11-11 00:42:10

[根据用户评论编辑]

所以你想从jar中提取javadoc...

首先你必须明白,如果你的jar不包含源代码,而只包含编译后的代码,那么你的javadoc将不会显示任何注释。

然后,您只需使用任何 zip 程序提取 jar 中的文件(例如,在 Windows 上,将文件重命名为 .zip,然后提取它)。

最后要做的事情是调用 javadoc 工具。就像其他人所说的那样,您可以使用 IDE,或者只需从命令行调用:

http://download.oracle.com/javase/1.5.0/docs/tooldocs/windows/javadoc.html#examples

javadoc -d \home\html -sourcepath \home\src -subpackages java -exclude java.net:java.lang

[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 -d \home\html -sourcepath \home\src -subpackages java -exclude java.net:java.lang
寄人书 2024-11-11 00:42:10

据我所知,按照预期的方式创建 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.

女中豪杰 2024-11-11 00:42:10

将 .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.

酒解孤独 2024-11-11 00:42:10

我从不是由您创建的 jar 文件创建了一个 JAVADOC ,即您没有其源代码。

它简单但棘手。

  1. 使用java反编译器从.jar文件中获取源代码。我使用 JD-GUI | Java Decompiler
  2. 在 myEclipse 中创建一个新项目,并将“源代码”复制到源文件夹中。
  3. 项目菜单中,您将看到生成Javadoc。单击并选择您的项目并按照步骤操作。完成后 Java 文档就准备好了。

干杯

伊姆兰·塔里克

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.

  1. Get source code from .jar file by using java decompiler. I use JD-GUI | Java Decompiler
  2. Make a new project in myEclipse and copy the 'source code' in source folder.
  3. In project menu you will see Generate Javadoc. Click and select you project and follow the steps. Java doc will be ready after you finish it.

Cheers

Imran Tariq

殊姿 2024-11-11 00:42:10

下载 APK 文件后,您需要执行以下步骤来获取可编辑的 java 代码/文档。

  1. 将您的 apk 文件转换为 zip(开始下载时不要去
    使用保存选项,只需选择另存为并提及您的
    扩展名为 .zip)通过这样做,您可以避免 APKTOOL...
  2. 解压 zip 文件,在那里您可以找到 somefilename.dex。所以
    现在我们需要转换 dex -> .class
  3. 为此,您需要 dex2jar(您可以从
    此处,解压后,在
    命令提示符你必须提到,
    [此处](请记住,您的 somefilename.dex 必须位于您所在的同一文件夹内
    保留你的 dex2jar。)
  4. 从以下位置下载 jad
    http://www.viralpatel.net/blogs/download/jad/jad.zip
    提取它。解压后,您可以看到两个文件,例如“jad.exe”和
    “Readme.txt”(有时可能是“jad.txt”而不是“jad.exe”,所以
    只需将其扩展名重命名为.exe 即可运行)
  5. 最后,在命令提示符中,您必须提及 [D:\jad>jad
    -sjava yourfilename.class]
    它将把你的类文件解析成可编辑的java文档。

Once you downloaded your APK file , You need to do the following steps to get a editable java code/document.

  1. Convert your apk file to zip (while start your download don't go
    with save option , just go with save as and mention your
    extension as .zip) by doing like this you may avoid APKTOOL...
  2. Extract the zip file , there you can find somefilename.dex. so
    now we need to convert dex -> .class
  3. To do that, you need dex2jar(you can download it from
    here , 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.)
  4. Download jad from
    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)
  5. Finally, in command prompt you have to mention like [D:\jad>jad
    -sjava yourfilename.class]
    it will parse your class file into editable java document.
染柒℉ 2024-11-11 00:42:10

在 Maven 中使用 mvn javadoc:javadoc

Use mvn javadoc:javadoc in Maven.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文