X

Geertjan's Blog

  • August 31, 2011

Javadoc & Sources of 3rd Party JAR (Part 1)

Geertjan Wielenga
Product Manager

You'd like to include a 3rd party JAR in your NetBeans Platform application. It would then also be handy to be able to read the related javadoc in the NetBeans Java Editor and to browse from there into the sources of the JAR.

How to do this? I figured out a solution today. (It will be much better & smoother in 7.1, where absence of sources upon request will prompt you to assign sources for the JAR.)

As an example, I'll take the interesting looking xmlworker JAR (apparently lets you convert XML to PDF) from the iText project.

  1. Right-click a module where you need to use the JAR and choose Properties. In the Project Properties dialog, go to Libraries | Wrapped JARs.

  2. Click Add JAR. When you select a JAR and afterwards via "Edit", you can associate javadoc and sources with the JAR:



  3. Look in project.properties of your module and you'll see something like this, which is all that the previous step did for you:
  4. javadoc.reference.xmlworker-1.1.0.jar=/home/geertjan/Downloads/itext
    /xmlworker-1.1.0-javadoc.jar
    source.reference.xmlworker-1.1.0.jar=/home/geertjan/Downloads/itext
    /xmlworker-1.1.0-sources.jar

  5. And now you can read the related javadoc in the Java Editor (and Ctrl-Click into the sources):


Join the discussion

Comments ( 5 )
  • Eric Aili Friday, September 2, 2011

    Thank you!

    This has been annoying me for a long, long time and this solution is much neater than the one we discussed during the platform training.

    Oh, and it works fine with moving the project.properties entries to private/project-private.properties as well.

    (And now I also have to look into the plans for 7.1 on this...)

    Eric


  • Dorae Thursday, March 8, 2012

    Hi, thanks for the trick. However, what if I have quite a number of .jar wrapped in a library wrapper module? Adding javadoc and sources one by one is the only way out?


  • guest Tuesday, May 29, 2012

    That doesn't work. I tried removing and re-wrapping the JUNG libraries ( http://jung.sourceforge.net/ ) along with its API docs that come in zip format. After placing the API zip ( jung2-2_0_1-apidocs.zip ) file inside .\AllMyLibrariesModule\release\modules\ext and followng the above procedure (!) it didnt work. I also tried editing project.properties by hand which didnt work either.


  • Geertjan Tuesday, May 29, 2012

    Why are you using 'release\modules\ext'? Just put it somewhere on your disk, not necessarily in that folder -- as you can see from the screenshots above.


  • guest Thursday, May 31, 2012

    Geerttjan hello! is there a problem putting something in release\modules\ext ?

    Take a look at my project.properties

    file.reference.jung-api-2.0.1.jar=release/modules/ext/jung-api-2.0.1.jar

    javadoc.reference.jung-api-2.0.1.jar=release/modules/ext/jung2-2_0_1-apidocs.zip!/apidocs/


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.