# Lab-5540: Save Time—Build Desktop Applications Quickly with the NetBeans Platform

Expected Duration: 100 minutes
Contacts: Jiri Rechtacek, Lukas Hasik

Introduction | Exercise 0 | Exercise 1 | Exercise 2 | Exercise 3 | Exercise 4 | Summary
2. Introduction Background Information Steps to Follow Summary ## Exercise 4: Packaging, publishing, updating (20 minutes) ### Background Information About NBM format Every NetBeans module has the capability to create a NetBeans package which contains the project's binaries, together with meta-data describing the author of the plugin and the the license. As well, the meta-data contains a name and a description of the plugin and the category to which it belongs. You can find more information at DevFaqWhatIsNbm. About Autoupdate Functionality and the Plugin Manager NetBeans Autoupdate functionality provides several services to the IDE: download and install available updates of installed modules, search and then install new features from subscribed Update Centers, browsing and manipulating the modules in IDE installation. What is a Update Center? Update Center is a place with own URL containing a set of NetBeans NBM Package files (NBMs) and a descriptor (a XML based file) describing these NBMs. Such Update Center Descriptors can be add into IDE as new NetBeans Update Centers. NetBeans uses Update Centers for delivering new features for NetBeans IDE and also for delivering updates to allow users to keep the IDE up to date. What is the NetBeans Plugin Portal? The Plugin Portal is a web application that allows the NetBeans community to contribute to the NetBeans plugin eco-system by adding plugins and also commenting on and rating the existing plugins. ### Steps to Follow Step 1: Create NBM action Each NetBeans project has Make NBM action in own project's popup. This action allows you build own NBM package from project. You can deliver the NBM file to others: send via mail, publish on you weblog, etc. For installing an NBM into a NetBeans Platform application, use the Plugin Manager, invoke Tools | Plugins in the application. Step 2: Customize meta-data for visualizing in Plugin Manager Open the NetBeans Project Properties aka project customizer from project's popup. Choose the Display category. There you can select some suitable category if any, or create new one. Let's create Games category for this project. Then fill in the Short & Long Descriptions of the project. The Plugin Manager will display this information to allow users for searching. Important: to ensure a NBM will be visible in NetBeans Plugin Manager you have to check Show in Plugin Manager. Other interesting information is in Packaging category. There you should fill in your name, a home page this project and a license. Important: This form contains a check box Needs Restart on Install. If checked this option, the IDE forces restart IDE when this NBM is installing. Use this option carefully. Check it only if you really need to restart whole IDE for setup it completely. > Step 3: Invoke Create NBM action and install NBM into IDE Invoke Create NBM and build NBM file from the project. Look at Output tab . There is info where the NBM was created. How can I try the NBM out? We need a fresh IDE to test the installation on the newly created NBM. To run a fresh IDE we need to run NetBeans IDE with special option `--userdir`, best would be to use a command line client. Invoke something like:
       [jirka@rechtacek-nb kenai]$ cd $NETBEANS_INSTALLATION_DIR
       [jirka@rechtacek-nb nb_all]$ cd netbeans/bin/
       [jirka@rechtacek-nb nbbuild]$ ./netbeans --userdir /tmp/testnbm
When IDE starts up we can open Plugin Manager from Tools | Plugins. Switch to the Downloaded tab and press a Add plugins button, browse on the NBM that you built in previous steps. The Plugin Manager shows the NBM and we can install it. Note: While installing the NBM you are got a warning the NBM aka plugin is not signed. Just ignore it for now, and continue in installation. For more information about signing check out DevFaqSignNbm. Step 4: Create own Update Center Now switch back into the IDE containing our projects. Beside creating individual NBM files, IDE offers to make own Update Center. As we said before, the Update Center consists a XML file describing a set of NBM files. Action Create NBMs is available for each module suite of NetBeans modules. This action when invoked, creates an Update Center which contains both projects: Anagram JavaOne 2009 Word Scrambler You find the placement of the XML file with both NBMs describing the Update Center in the Output window. Step 5: Add new Update Center into IDE If we would like to add this new Update Center, we use the second instance of IDE which should be still running. There, open the Plugin Manager again. Switch into Settings tab. In this tab is a button Add for adding new Update Centers. Adding new Update Center should add a new item into Available Plugins. Why just only one although the UC contains both modules? Cause, the Anagram JavaOne 2009 is already installed in a previous step. It means, we can install the Word Scrambler into application, Word Scrambler hasn't been installed yet. Step 6: Publish a NBM on Plugin Portal We created a NBM files, to built own Update Center. It allows to deliver either our plugins as NBM packages or we may expose our Update Center xml on our web site. Then you can provide just URL link to the Update Center. On NetBeans site is a additional option how to publish plugins - using NetBeans Plugin Portal. For using this portal we need a registration. If you don't have account, you can easily create new one at Join NetBeans. All registered users can upload own plugins at NetBeans Plugin Portal. For uploading a NBM you have to upload the NBM file first and then fill in the form with basic meta-data like project's meta-data which we filling in the previous step 2 Exposing plugins on the Plugin Portal makes possible to share our contributions with other NetBeans users, moreover to rate these plugins. Note: In the case you would like to promote a plugin for the wider audience, you have request for a verification of quality. If the plugin passed then the plugin will be offered to all users of NetBeans IDE via Plugin Manager. Check out the page FaqPluginVerificationRequest. ### Summary Back to top To summary