Convert .jar file to JAVA DOC

老子叫甜甜 提交于 2019-12-12 02:08:29

问题


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.


回答1:


[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



回答2:


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.




回答3:


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.




回答4:


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




回答5:


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.



回答6:


Use mvn javadoc:javadoc in Maven.



来源:https://stackoverflow.com/questions/5817653/convert-jar-file-to-java-doc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!