Running With the Netbeans Platform

This is the second of two posts documenting the creation of a Netbeans module, and running it stand-alone on the Netbeans Platform. The first post was Newbee NetBean Module Creation. It's been over a month since that first post, and a lot longer than I intended. Unfortunately life intruded. I'm now on vacation (working around the house on my infinitely long honey-do list) and making the odd post. I've now caught up somewhat and I can relax and look at my other lists of things to do, such as this series.

The Netbeans Platform is the equivalent of the Eclipse Projects Rich Client Platform (or RCP SDK). The significant difference between the Netbeans Platform and the RCP is that the Netbeans Platform will run out-of-the-box (although it is very dull at that point) while the RCP must be combined with a Eclipse plugin and configured to run as a complete application (although this is not hard to do). The Netbeans Platform appears at first blush to be easier to work with.

You need to get the Netbeans Platform. When you go to the download page, make sure to select release 4.1, that you select the release version, and then select the platform you're running on (Windows, Linux, etc). For this example I'm running on Windows, so I'll install And as before, it will be installed in my Java work area, C:\Java. In addition, I have created an empty work user directory, C:\Java\nb_test.
  1. To install the Anagrams plug-in/module into the NetBeans Platform, you need to run the platform. Go to the directory where the NetBeans Platform distribution was extracted.
    Change directory into netbeans\platform5\lib (in my case, C:\Java\netbeans\platform5\lib). In this directory is a Windows binary called nbexec. So that you don't collide with the NetBeans settings in your .netbeans directory, you should pass the --userdir [test_dir] arg to nbexec. For instance, to set the C:\Java\nb_test as the userdir for the NetBeans Platform (as well as to just test the platform), you would execute:
    C:> nbexec --userdir C:\Java\nb_test
  2. To illustrate how lightweight the NetBeans Platform is, select the File > View Toolbars and select the checkbox next to Memory. You will now see a Java heap memory usage meter in the NetBeans Platform toolbar. The NetBeans Platform is only using a small amount of Java heap. In this example, it's about 7 meg.

  3. To add the Anagram plug-in / module, select the Tools > Update Center menu item. Click the radio button "Install Manually Downloaded Modules (.nbm Files) and press the Next button.

  4. Click on the Add button and traverse to the directory where you created your Anagram project back in Step 5 of the first post. In the Anagram project directory you will find the an anagrams.nbm file. Select this file and press Ok. Click the Next button. Click the Next button again. The NetBeans Platform will install the anagrams plug-in / module very quickly. Press the Next button again. Check the box next in the "Include" column. The NetBeans Platform will tell you this module is an unsigned plug-in/module and ask if you want to install it anyway. Say, "Yes" to proceed with the installation. Then, press the Finish button.

  5. You will now see a "Games" menu in the NetBeans Platform (see the image at step two above). Go ahead and click on the Games menu and select Anagrams.
One of the advantages of installing plug-ins / modules in the NetBeans IDE is that you can use the NetBeans tools such as the debugger to help debug the plug-in. One of the things you'll need to do in order to re-install the plug-in as you go through the code, compile, test, debug cycle is to remove the old plug-in and its metadata in NetBeans. Unfortunately, you have to do this manually.

If you are working with the NetBeans Platform and you want to remove the plug-in so you can re-install a different one, go to the directory you specified as the --userdir. Above we used C:\Java\nb_test. You will need to remove the following files:

If you are working with the NetBeans IDE and you want to remove the Anagrams plug-in after you have added it to the NetBeans IDE, go to the C:\Documents and Settings\[username]\.netbeans directory and remove the following files:

After you have removed these files you will be able make changes to your plug-in / module, rebuild it and re-install it.


Popular Posts