Learning the NetBeans Platform

Change the version number in a NetBeans Platform application

You have developed your application on top of the NetBeans platform? Now I guess that when you start it, you see a weird build version number in the title bar…

Version number

If you want to set your own version number, you just have to set the “netbeans.buildnumber” property when the application starts (in a ModuleInstall class for example):

System.setProperty(“netbeans.buildnumber”, “0.1.0”);

Version number

Two interesting posts on this subject:

April 15, 2009 Posted by | NetBeans RCP | Leave a comment

Hibernate with the NetBeans Platform

I’ve had some difficulties using Hibernate in my NetBeans Platform application… so here is a quick summary of what I did. I created 4 NetBeans modules:

  • Derby
  • Hibernate
  • DataModel
  • Entities

Derby and Hibernate are library wrapper modules that contain JAR files.

modules

  • Hibernate depends on Entities and on Derby
  • DataModel depends on Entities and Hibernate

I added some files in the Hibernate module:

  • log4j.properties
  • org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer (for the correct initialization of the module)

hibernate

In Entities, I created the object “Imports” that needs to be stored in the DB:

  • hibernate.cfg.xml
  • Imports.hbm.xml
  • Imports.java

entities

In DataModel, I have an installer (extends ModuleInstall) class that creates the connection to the DB:

  • sessionFactory = new Configuration().configure().buildSessionFactory();

Finally, I modified the project.properties file of the application to ignore some messages:

  • run.args.extra=-J-Dorg.netbeans.ProxyClassLoader.level=1000

And there we are, the application is connected to the Derby database when it is started !

April 8, 2009 Posted by | NetBeans RCP | 5 Comments

Adding explorer components into the NetBeans palette

To add explorer components (such as BeanTreeView or OutlineView) from the package “org.openide.explorer.view” into the palette (NetBeans 6.5):

  • Right click on the palette, select Palette Manager
  • Click Add from JAR
  • Select <path to NetBeans 6.5>\platform9\modules\org-openide-explorer.jar
  • Select the components that you want to add into the palette, click Next
  • Select a catetegory, click Finish

April 1, 2009 Posted by | NetBeans RCP | Leave a comment