Saturday, 27 February 2010

Portable JavaDB in NetBeans


Here is a little situation I got in recently.

I'm using my portable NetBeans 6.8 IDE with all my projects set up on the same flash drive. However when I was making the portable installation something slipped my attention, and here is the fix.

Some days ago I was reviewing one of the Patrick Keegan's JavaDB tutorials on a Windows laptop. Made the example and tweaked it a little but didn't go further about how the JavaDB drivers are set up - I taught that they're somewhere in the debris of the netbeans folder like MySQL's and PostgreSQL's drivers. After that I forgot about this example and the other day when I tried to open the same project in NetBeans IDE installed on an Ubuntu PC I got the warning sign for a reference problem. The IDE usually gives this one when a library is missing from the paths declared to the project. I opened the "Resolve Reference Problem" dialog from the context menu and only the derby.jar was listed in it. Didn't have time to fix it then but today decided to dig into it.

In the IDE when I went to "Tools > Libraries" I found such for MySQL and PostgreSQL, but there was none for JavaDB. So I went to Services window and opened the Drivers node in order to see in the properties where the drivers were pointed to. This is what I found:



So I needed to do a fresh and prferrably portable JavaDB installation in order to fix this issue. Since I wanted it portable, I couldn't use the MSI installer for Windows - the installer actually couldn't see my portable device (unless you write it manually instead of using the Browse button) even though it lets you change the installation path. To spare myself time and possible troubles, I chose the platform independent ZIP archive package. I extracted it directly into the root of my flash drive and in the IDE's Service window customized the drivers' nodes to point in the right directions (the JARs are located in the lib folder of the package). The same approach can be taken in a Linux/UNIX environments.
Now I could resolve the reference problem.
And after making sure the project runs and has DB capabilities I can say that today my IDE is yet again a little further more portable than before.
Post a Comment