Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to embed javadoc into a jar

Is there a way to embed javadoc (/doc folder produced by JavaDoc Ant Task) into my library jar which contains my .class files?

I would prefer not to ship source and would like the users to be able to see the javadoc comments in eclipse without having to go through Referenced Libraries tab and adding the JavaDoc zip to my third-party lib.

like image 205
AndroidPlaya Avatar asked May 05 '11 00:05

AndroidPlaya


2 Answers

Sure you can put javadoc into your binary JAR file ... but does it really make sense?

In order to read the javadocs, a user is going to have to unpack the HTML files from the JAR file into the Android's filesystem, and then point the Android browser at the index.html file (or whatever). But the best model for using JAR file to run your code is NOT to unpack it. And if you don't expect your users to try to view the javadoc on their phones (!?!) ... then putting the javadocs into the JAR file is "dead weight".

It makes much more sense to distribute the javadoc tree in a separate zip or tar file.

Finally, if you expect users to develop code against the APIs in your product, it will be a lot easier for them if you provide them with source code. You'll get better customer satisfaction, fewer support requests to help them debug their code, and fewer unjustified complaints about your code not working.

like image 161
Stephen C Avatar answered Oct 04 '22 07:10

Stephen C


Sure you can update a jar file this way.

jar uf <your_jar> doc/<your doc file>

like image 28
CoolBeans Avatar answered Oct 04 '22 08:10

CoolBeans