简体   繁体   中英

Convert .jar file to JAVA DOC

How can I put my jar file to web. ie is there a software that decompile jar file and make html pages of it? In other words I want to make a java doc.

[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

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.

Use mvn javadoc:javadoc in Maven.

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.

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. Seehere to convert java source to javadoc.

I have created a JAVADOC from a jar file that is not created by you ie 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM