Reputation: 1427
When I build my project to a Jar file with Ant, I generate javadoc the same time.
So I tried to add the javadoc files' location path in 'javadoc Location' of Properties of my new Project,it doesn't work, even if Eclipse tell me the 'Location is likely valid'.
When I open it in Browser,the Url is like file:///file:/C:/Users/topxebec/Desktop/doc/index.html
, there's two prefix in the url,but in the eclipse I only have file:/C:/Users/topxebec/Desktop/doc/index.html,
.
I tried to change it to C:/Users/tongxuebin/Desktop/doc/
but Eclipse said it was a Invalid URL.
So how to solve this problem? Or,can I simply save the comments in the Jar when it generated by Ant?
Upvotes: 2
Views: 1769
Reputation: 18704
It seems, that you can't put the javadoc in the same jar as the class files, so that eclipse will automatically show the doc.
A solution is to include the source-code. This will also help, if you need to debug the classes in that jar.
This answer: How can I build my jar file so that users who use the library will be able to see the javadoc in Eclipse covers that case. But it just boils down to:
<target name="jar.noCompile.src">
<jar destfile="${ant.project.name}.jar">
<fileset dir="${classes}"/>
<fileset dir="${src}" includes="**/*.java"/>
</jar>
</target>
Upvotes: 1