Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need both javadoc and sources jar?

Generally, when publishing a library, do we need both sources.jar and javadoc.jar? I don't really understand the purpose of javadoc.jar.If it's about the code documentation, the IDE can show it from sources.jar itself.

Example: enter image description here

Please note, this is not a duplicate of What are the differences between javadoc.jar, sources.jar and .jar?. I am looking for what javadoc.jar can do, that sources.jar can't.

like image 698
theapache64 Avatar asked Oct 20 '25 16:10

theapache64


2 Answers

Let me address the questions one by one:

Why does javadoc.jar even exist if sources.jar can be used?

This question basically addresses the developers. If the sources can't be shared (e.g. it might be proprietary) sharing the documentation is still going to help.

Why do developers provide both?

A very simple reason might be because that's the default for Maven, Gradle etc.

Another reason might be that some organizations don't allow access to source code for security reasons (or others) or can't/don't want to build the HMTL files themselves but rather just host them.

Why do I as a developer need to import javadoc.jar into my IDE if I can use sources.jar?

I'd say you shouldn't need to. As a dev I often find it very useful to have the sources available for debugging etc. so I'd prefer source.jar.

like image 55
Thomas Avatar answered Oct 23 '25 06:10

Thomas


The tool generating javadoc may not be generated using the standard doclet making using the sources to render potentially undesirable. As your IDE might not understand how to render the format the authors chose to put in their source code.

like image 37
xenoterracide Avatar answered Oct 23 '25 07:10

xenoterracide



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!