• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

How to see the java documentation for a method in a class which is inside a jar file?

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a class ABC.class with a method doStart(). This method has some documention which explains the functionality of the method. Now I have this class inside a jar file , say myProject.jar. I have myProject.jar in my classpath and I am using the doStart() method in another java file ( say myClient.java). Now I have the myClient.java open in my Eclipse and I want to see the user must see the documentation for the doStart() method while he hover the mose point in the .doStart() . ( like for any Java standard API we get the help). I hope the question is clear. Please let me know .

Regards,
PS
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
whether your jar has a source files? if yes you unpack and attach the source file into your eclipse[i assume that you know this step]
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And welcome to javaranch pillaip pillai
 
Prasanth S Pillai
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Seetharaman. I am aware of that step which you mentioned. Unfortunately I do not want to do that.I would prefer the jar file to be given to different application so that they can use the function.
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will need to make the javadocs for the JAR, and then to move those JavaDocs to a location defined in the Project\Properties\JavaDoc Location.
 
Prasanth S Pillai
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks Luke. But I have a question. I open the rt.jar which comes with jdk. I did not see any javadoc folder in it. How I am able to see the documention for methods or constants? for instance, if I hover my mouse over System.out.println, I can see the explanation for each. I am aware that it is coming from the java doc part. But the question is where is it in the rt.jar?
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The JavaDoc for the standard API is special. On my one system it is pulling from the the internet (http://java.sun.com/javase/6/docs/api/) and for another it found the local copy I had of the JavaDocs installed under my JRE. You can set those values using Window\Preferences\Java\Installed JREs. Select the JRE you want to set the JavaDocs for and press Edit. Select the JAR file(s) and press the JavaDoc Location and set it either to a local (file://) or web (http://) url, or to an Archive.

For other sources of JavaDocs the docs have to found in the folder as described above.
 
Prasanth S Pillai
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Luke.. That works. But everytime if I give my jar file to different folks, then they need to do this excerise ? I mean unzio the my jar file, get the javadoc folder and place it in their local machine and then edit the Javadoc location as you mentioned in your reply? There must be some alternative so that the user do not have to do it manually.

regards,
pillai
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can think of two ways:

1) Since you are shipping code, and worried about how it works in Eclipse, then ship your code as an Eclipse project, preconfigured with the JavaDocs setup.

2) Package the JavaDocs in the JAR, in a directory like MyJar!/docs/. This may work, not sure. When the user adds the JAR to the workspace using Project\Properties\Java Build Path\Libraries - Add External JAR the JAR you add has a tree-expansion node. Expand the tree and there is a JavaDoc location. Select it, press edit, choose the JavaDoc In Archive option and navigate to the same JAR, and for the Path within Archive choose the /docs/ directory you put the JavaDocs into. Yes the user probably has to do this themselves. And while they are at it, you might want to instruct them to set the source attachment at the same time since you are providing them the source code.

 
Prasanth S Pillai
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I will have to go for the 1st option. 2nd option works fine, I am not denying that. But 1st option is better. Thanks Luke for your help.

regards,
Prasanth
 
reply
    Bookmark Topic Watch Topic
  • New Topic