Saturday, March 15, 2014

Libgdx Extensions Javadocs or How to Extract Javadocs from Source Jars

Hi,

A lot of open source projects like Libgdx package sources in jars. So how do you generate Javadocs with the Javadoc command directly from a jar file?

You can't. You have to extract the jar first.

Specifically for Libgdx, extensions are not documented in the http://libgdx.badlogicgames.com/nightlies/docs/api/ online Javadoc.

One alternative is to just attach the source jars with whatever editor you are using, such as Eclipse. For Eclipse, right click on the project -> build path -> configure build path. Then there should be a window similar to this:



Click the plus symbol next to the jar, then double click source attachment. A dialog box will appear to allow you to attach the source jar.





However, this does not solve the original problem. You want an HTML Javadoc Index.html file to look at, possibly on a multi-monitor setup. No problem. Create a small script to extract the jar files and build the Javadoc for you (or use Ant or build tool of your choosing).

The below is specific to Libgdx but could be modified for any open source project with source jars. Download the Libgdx nightly here http://libgdx.badlogicgames.com/nightlies/

1.

touch ./extensions-javadoc


2.
chmod 755 ./extensions-javadoc
 
3. Open extensions-javadoc with your favourite text editor and paste below

#!/bin/bash

mkdir extension-sources
cd extension-sources
jar -xvf ./../extensions/gdx-audio/sources/gdx-audio-sources.jar
jar -xvf ./../extensions/gdx-bullet/sources/gdx-bullet-sources.jar
jar -xvf ./../extensions/gdx-controllers/sources/gdx-controllers-android-sources.jar
jar -xvf ./../extensions/gdx-controllers/sources/gdx-controllers-desktop-sources.jar
jar -xvf ./../extensions/gdx-controllers/sources/gdx-controllers-gwt-sources.jar
jar -xvf ./../extensions/gdx-controllers/sources/gdx-controllers-sources.jar
jar -xvf ./../extensions/gdx-freetype/sources/gdx-freetype-sources.jar
jar -xvf ./../extensions/gdx-image/sources/gdx-image-sources.jar
jar -xvf ./../extensions/gdx-jnigen/sources/gdx-jnigen-sources.jar
jar -xvf ./../extensions/gdx-tiled-preprocessor/sources/gdx-tiled-preprocessor-sources.jar
jar -xvf ./../extensions/gdx-tools/sources/gdx-tools-sources.jar

javadoc -d ./../docs-extensions -sourcepath ./ -subpackages com
 


4. Save and run script
./extensions-javadoc
Rejoice at your newly available HTML Javadocs!

5 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete
  2. Thank you for sharing this informative post.MyAssignmenthelp.com is giving assignment help to students.we are already trusted by thousands of students who struggle to write their academic papers and also by those students who simply want English homework help canada to save their time and make life easy.Are you on the lookout for flawless Online English Homework help in Canada? This blog will greet you with reliable insights. A case study requires investigating a specific issue of the Help with english homework, examining the alternative solutions, and proposing the most effective solution by using suitable supporting evidence.

    ReplyDelete
  3. Excellent information Providing by your Article, thank you for taking the time to share with us such a nice article. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Kindly visit livewebtutors website we providing best assignment help services in Australia.
    Read more now :- My Assignment Help

    ReplyDelete
  4. Still, not getting effective Assignment Help for your project submission? Don’t get panic! Browse the website greatassignmenthelp to connect with the remarkable academic writers to complete your project. Don’t waste your time and place your order right now!
    Assignment Help Online
    Online Assignment Help
    Assignment Help Online Services
    Assignment Helper
    Assignment Assistance
    Assignment Help Experts
    Online Assignment Help Services

    ReplyDelete
  5. A special thanks to My Assignment Help for providing a well-written assignment. You guys were a savior to me. Will contact you soon for my upcoming assignments. You can email us at cs@Myassignmenthelpau.Com or Phone Number: +61-2-8005-8227

    ReplyDelete