问题
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.
- Get source code from .jar file by using java decompiler. I use JD-GUI | Java Decompiler
- Make a new project in myEclipse and copy the 'source code' in source folder.
- 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.
- Convert your apk file to zip (while start your download don't go
with
save
option , just go withsave as
and mention your extension as .zip) by doing like this you may avoid APKTOOL... - Extract the zip file , there you can find somefilename.dex. so now we need to convert dex -> .class
- 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.) - 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)
- 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