Reviewing NetBeans Book

This year, I received an email from Packt Publishing, inviting me to review one of the books based on NetBeans IDE, Java EE 5 Development with NetBeans 6. I was quite excited about this opportunity and after exchanging few mails with their Market Research Executive, accepted the invitation.

After nearly 2 months, I was able to finish reading the book and here’s my review of the book. Read it carefully and I feel you would enjoy reading the book as I did, because of its easy reading style and effectiveness of communicating complex topics.

Stay tuned..

Advertisements

NetBeans Community Docs User Survey

Take the NetBeans Community Docs User Survey

The NetBeans Community Docs program is a great source of community-authored content about using the NetBeans IDE. Now the team behind the program wants your feedback to help make the program even better. What type of content do you like? Do you want more tech tips or prefer multimedia material? Take the survey and let the team know!

Well, this is an important news item for the NetBeans Community, thus it was necessary to let the community know about it on large scale. Kristian Rink, NBCD Coordinator and its Evangelist setup the survey that contains almost every question, our team wants the community to answer.

Thanking you..

taT | Hacking Modules..

Ever wondered, apart from extending the NetBeans IDE, or some application based on NetBeans Platform. What else can be done with the module?

Brief Overview

Well, NetBeans IDE provides Module Development Support by providing 4 kinds of Project Templates;

  1. Module
  2. Module Suite
  3. Library Wrapper Module
  4. NetBeans Platform Application

I have some knowledge of the first two, so we will stick to them for the rest of this post. So, lets have a look at the simplistic module structure;

Module Structure

This is what you see when you expand the Project node in Files View. We will focus on platform.properties, project.xml. If you switch to the Project View, you would see the files with following names, visible under Important Files node.

NetBeans Platform Config

So, that’s basically the logical view of the file platform.properties. In the past, I have written some pretty useful tips and Tricks (contributed to NetBeans Community Docs) based on this file;

  1. Configure Clusters and Modules
  2. Managing NetBeans Platforms

Project Metadata

This is the logical view of the file project.xml. There’s one more useful tips and Tricks (contributed), that’s based on this file, which lets you add your module as friends to those modules, if you want your module to depend on the specification version of the same.

NetBeans IDE 6.7 (Click to enlarge)

Playing Tricks..

I will be making use of NetBeans 6.7 IDE. Although, these tricks should work well with NetBeans 6.x IDE. So, lets answer the question I asked in the beginning.. Generally, when you create Module project, you get an option to either create it as Standalone Module or Add to Module Suite.

Standalone Module

When you choose this option, you also get an option to select NetBeans Platform of your choice, along with Manage.. button. If you want to know more about that, refer this contribution.

Suppose, I choose NetBeans 6.5 Build (added with name as 65 in Platform Manager) as Platform and move ahead. I would be able to use 6.7 IDE to create module, targeted for NetBeans 6.5 IDE. The module’s platform.properties looks like this;

nbplatform.active=65

This would enable the running IDE to achieve the desired result, as mentioned above. Now, running the module will ofcourse launch NetBeans 6.5 IDE as Target Instance to see how your module works. This process might be slow, as you’re running full-fledged 6.5 IDE.

NetBeans 6.5 boots with a b'day stamp on splash screen!

If your module doesn’t depend on clusters other than platform (which is by default). Then, you can tweak the file as follows;

enabled.clusters=\
 platform
nbplatform.active=65

These clusters are bare-minimum essentials, that are enabled by default when you create the NetBeans Platform Application project using 6.5/6.7 IDE. The property enabled.clusters helps to enable only those clusters which are necessary to run this module.

Splash Screen for empty NetBeans Platform Application

Now, run your module and it will look like you’re running a NetBeans Platform Application having a single user-defined module. Here’s how module’s project.xml looks like;

<project xmlns="http://www.netbeans.org/ns/project/1">
   <type>org.netbeans.modules.apisupport.project</type>
   <configuration>
      <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
          <code-name-base>code.name.base.of.your.module</code-name-base>
          <standalone/>
          <module-dependencies>
           <!-- Here are your module dependencies.. -->
          </module-dependencies>
          <public-packages/>
      </data>
   </configuration>
</project>

Note the bold-faced tag <standalone />, this tells the NetBeans IDE that your module is not part of any module suite. Its a standalone module, as you created.

Add to Module Suite

If you decide to go with this option, you would then browse the filesystem to find the appropriate Module Suite project and then, move ahead.

In case of Module Suite projects, the enabled.clusters property automatically occurs/disappears, when you check/uncheck the modules and/or clusters from its Project Properties Wizard.

Note that the module, that becomes part of the suite, would use only those clusters which the suite has enabled. Along with that, suite-private.properties file is added under /nbproject/private. Also, take a look at the module’s project.xml;

<project xmlns="http://www.netbeans.org/ns/project/1">
   <type>org.netbeans.modules.apisupport.project</type>
   <configuration>
      <data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
          <code-name-base>code.name.base.of.your.module</code-name-base>
          <suite-component/>
          <module-dependencies>
           <!-- Here are your module dependencies.. -->
          </module-dependencies>
          <public-packages/>
      </data>
   </configuration>
</project>

Note the bold-faced tag <suite-component/>, this tells that NetBeans IDE that this module is part of a Module Suite project.

Tips to Remember

You may convert your standalone module to become part of suite, or vice-versa. Just add/remove suite-private.properties (Per Suite Locator) file and tweak your Module’s project.xml and Module Suite’s project.properties.

Also, note that some changes have taken place in NetBeans 6.7 IDE, you may find out more over the web. One more thing, NetBeans 6.5 IDE added suite.properties file under /nbproject and had same tag as <suite-component/>. I think NetBeans 6.0 and 6.1 might do the same. Please try it yourself and let me know.

Stay tuned..

taT | Hacking Project Properties

Yesterday, I recreated one of the Visual Library Sample  (basically a tutorial based on it at Dzone) using NetBeans 6.7 IDE on Windows XP Professional SP2. The sample was Java Application that had two JAR’s (present in the platform7 cluster of NetBeans 6.0 IDE) in its classpath.

I followed the tutorial and successfully executed the application. Fortunately, I have NetBeans IDE from 5.5 onwards, so there wasn’t any issue finding the JAR’s and adding them in the application’s classpath.

I didn’t knew whether it will work with cluster from higher release or not. Hence, I decided to give it a try by making use of clusters from 6.1, 6.5 and finally, 6.7.

Playing Tricks..

Now, removing/adding JAR’s again and again can be boring/cumbersome if you have several releases stored under different hierarchies of your filesystem. So, I looked into the various files created under /nbproject to inspect how these JAR’s being referred.

When you right-click Libraries Node and click Add JAR/Folder..

right-click Libraries Node (Click to enlarge)

You’re prompted with the dialog for browsing and then, selecting Reference/Absolute Path as per your choice.

Browse to select platform7 cluster (Click to enlarge)

I selected the platform7 cluster (see above figure) and selected the JAR’s shown in the following figure.

Selected JARs from platform7 cluster

/nbproject/project.properties

This file contains all the project related properties, that are accessed by build-impl.xml (created from project.xml automatically) for necessary Ant operations.

file.reference.org-netbeans-api-visual.jar=\
  path\\to\\cluster\\modules\\org-netbeans-api-visual.jar
file.reference.org-openide-util.jar=\
  path\\to\\cluster\\lib\\org-openide-util.jar
includes=**
jar.compress=false
javac.classpath=\
 ${file.reference.org-openide-util.jar}:\
 ${file.reference.org-netbeans-api-visual.jar}:\
 ${libs.swing-layout.classpath}

The bold-faced text is added, once referenced JAR’s are added from Projects Window/Project Properties Wizard. Also, path\\to\\cluster refers to the directory where the platform cluster is stored. In case of the above application, here’s the path;

E:\\OpenSource\\NetBeans_Archies\\NetBeans 6.0\\platform7

Playing with Clusters

Now, as you can see the path\\to\\cluster is the same in this case. So, I introduce another property that will have the path as value.

path.to.cluster.platform=\
  E:\\OpenSource\\NetBeans_Archies\\NetBeans 6.0\\platform7
file.reference.org-netbeans-api-visual.jar=\
  ${path.to.cluster.platform}\\modules\\org-netbeans-api-visual.jar
file.reference.org-openide-util.jar=\
  ${path.to.cluster.platform}\\lib\\org-openide-util.jar

This way, the referenced JAR’s become dependent on this property. Now, one can also change the value of this property, i.e. if one is interested in using JAR’s from platform cluster of higher releases of the NetBeans IDE.

Then, NetBeans will automatically scan the project, to update dependencies. For instance, I opted for platform9 cluster from NetBeans 6.5 IDE.

path.to.cluster.platform=\
  E:\\OpenSource\\NetBeans 6.5\\platform9

I just made changes at one place, that will be automatically reflected in other properties that depend on it directly/indirectly.

Tips to Remember

However, you need to check your code, once you do these changes, as this might cause warnings on deprecated usage of certain API, when you build your application.

Also, if you do any error while editing your project.properties as for this scenario, or any other. You may end up seeing lots of error badges in your code and possibly, get an added menu item (Resolve Reference Problems..) in the project’s context menu.

Stay tuned..

Community Docs and NetBeans

This is the first time, I thought of filing an issue for NetBeans Community Docs Program as I have never ever thought there would be a need for it, in the past 2 years. Generally, no one has ever done that, AFAIK.

I have been an active contributor to NetBeans Community Docs Program and managed it as coordinator for the duration of 11 months (May ’08 – Mar ’09). However, I feel there’s lack of coverage of the resources, that are gathered and arranged in the form of several wikis interrelated with each other in a systematic way.

Through this issue, I would like to see increased presence of NetBeans Community Docs in the NetBeans Community. I have some ideas which I would like to put forward, but first I want to see interest from your side (Community Members and NetBeans Team).

You’re welcome to add your comments/suggestions or even vote for this issue. See the following for latest updates.

Jul 14, 2009

Kristian Rink has setup a user survey. Please go and fill up the forms. We need your feedback, so that we can be in better position to decide the future of this program.

Jul 08, 2009

Kristian Rink has written a post discussing the future of the program and what does the community think about it? I feel you must go through it once.

Jul 03, 2009

Since VOC Captains have CC’ed themselves on issue report and I got reply from Michel. Here are I am sharing my ideas and related details;

Brief History

There are over 300 docs, right? When we reached 250 docs, I realized that there was findability issue. If I need a tutorial on how to make use of some feature, which is documented only by a community member and not by Sun writers. Then, user has to put some effort to locate that. Even I had that problem.

So, through mutual agreement, we created several category-specific wikis that would archive docs belonging to those categories. You may read more about that here;

http://nb-community-docs.blogspot.com/2008/11/netbeans-community-docs-reloaded.html

This way we were able to fix the findability issue, temporarily. Yes, temporarily! I thought, we were still missing a page which can provide pointers to all the sections of these category-specific wikis. So, I decided to setup a wiki;

http://wiki.netbeans.org/NBCDMatrix

that will do the needful. Now, if anyone wants (community contributed) tutorials on GUI Builder, just need to bookmark this link;

http://wiki.netbeans.org/NBCDMatrix#section-NBCDMatrix-SwingGUIBuilder

This contains a matrix which has necessary pointers to tackle the issue.

Ideas

Now, coming to the point of concern, i.e. the NetBeans Community Website doesn’t feature pointers to these wikis. As you might know that currently there’s only one pointer to the Community Docs Contributions list from relevant Learning Trails.

Instead, I would love to see a separate “Community Contributed Docs” Learning Trails, where one can have relevant information on how to access these wikis. Also, I would request the NB Team remove the following webpage;

http://www.netbeans.org/community/commdocs.html

Its better to have single Learning Trails page to focus on the above issue, rather than maintaining small sections on every Learning Trail and maintaining the above webpage. It will also ease the work spent by NB Team on such maintenance. Also, the proposed Learning Trail can also be pointed from User FAQs, Developer FAQs, etc.

If someone is unable to find  necessary info in these FAQs, then he/she may navigate to the trail to learn how to find out community contributed docs for their requirement. This should be good enough to make our presence felt in the community, as this Learning Trails would feature in Docs & Support page.

Thanks!