How do I use third party/external java libraries in my NetBeans plug-in module?

Byron Tymvios

In order to use an external library in NetBeans plug-in modules you need to create a "Library Wrapper Module" project which will (when added to a module suite) exist on the module project's classpath.

Firstly in order to use a "Library Wrapper Module" you need to add both your "Module Project" as well as the "Library Wrapper Module" to a "Module Suite Project", the suite will allow you to access the library from your module. You can create a "Module Suite Project" by using the "New Project" wizard, once the wizard has started select "NetBeans Plug-in Modules" in the left pane, then select "Module Suite Project" from the right hand pane and click "Next >". Enter all the details for the suite project and click "Finish".

You can create a "Library Wrapper Module" by using the "New Project" wizard, once the wizard has started select "NetBeans Plug-in Modules" in the left pane, then select "Library Wrapper Module Project" from the right hand pane and click "Next >". Select the library to wrap and specify a license if one is necessary and click "Next >".

Specify the project properties (for this wrapper project) and select the "Module Suite" (which you created earlier) and click "Next >". Now on this screen you need to specify a "Code Name Base" for your library, this is the equivalent of packaging classes in java (it uniquely identifies a library), so specify a package name, also specify a display name and specify a localizing bundle if you have one. Now by going into the properties of the suite you created earlier you can add your module and your library wrapper to the suite by clicking the "Add..." button and then selecting the projects you want to add.

You will now be able to access the classes and methods from your external library from within your plug-in module.

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact