Migrating Netbeans Class Libraries Between Different Versions

By Teera Kanokkanjanarat

Netbeans allows you to bundle up related jar files together as a class library and apply them to any other projects. While it is easy to create, use, and remove class libraries, moving them from one version of Netbeans to another is not a trivial task.

By default, Netbeans will ask you if you want to import settings from previous version on the first time installation. However, it does not give you enough flexibility. For example, if you want to go back to previous stable version of Netbean,s how can you migrate new class libraries you have created on the newer version? Recreating all libraries over again can take quite an amount of time. Surely there must be an easy way to get around this problem.

Locating Netbeans user profile directory

First, we will have to locate where different versions of Netbeans have been installed on your computer.

See the details about userdir and cachedir locations at http://wiki.netbeans.org/FaqWhatIsUserdir.

1. Make sure that you still have the user directory from the version of the IDE containing class liraries on your system in its default install location.
2. On Microsoft Windows systems, Netbeans default installation location is C:\Documents and Settings\<username>\.netbeans\<version-number>\. On UNIX and Linux systems, the default location is /<home>/<username>/.netbeans/<version-number>/.
3. If the new version of the IDE is running, exit the IDE.

Migrating Netbeans class libraries configuration file

At this point, we have located where Netbeans store configuration file for class libraries the user have created. We will now go ahead and copying those library config files to new version of Netbeans.

1. Under "<home>/<username>/.netbeans/<previous version number>/config" folder, look for a folder "org-netbeans-api-project-libraries". This will be the place where all class libraries information of that Netbeans version are stored.
Figure 1: Figure 1: Locating config folder.


Figure 2: Locating org-netbeans-api-project-libraries under config folder.

2. Under this folder, you'll find another folder name "Libraries" which store a bunch of XML files describing each of all class libraries you've created.
Figure 3: Locating Libraries folder where class libraries XML config files are stored.

3. To port these libraries to other version of Netbeans, simply copy these XML files to corresponding "<home>/<username>/.netbeans/<destination version number>/config/org-netbeans-project-libraries/Library" and that's done.
Figure 3: Copying XML config files for class libraries you want, and put them on corresponding folder of the new Netbeans version.

4. Start Netbeans IDE and you will see that your class libraries have been copied from previous version.


Netbeans store user setting and preferences in XML format. This allows flexibility and readability for user to make change and understand these configuration files. This tutorial shows you how to go in and perform a quick migration of class libraries without having to re-install the IDE. You can also apply the same concept to other configuration items (for instance database connection info) as well.


By Jianwu: (2007-NOV-08) Thanks for providing this information. I agree that using XML is a helpful to migrate the configuration files as they are human readable. But I still feel NetBeans library manager is not good and convenient. I hope to see some improvement in the future version. I prefer more MAVEN style of dependency management. Here is some issue of current netbeans library management:

1. It's not friendly to teamwork. When one developer setup the library configuration, he has to instruct others on how to configure it. And whenever some library dependency changed, the synchronization work is tedious and error prone.
2. It’s not friendly to automated build-process. As the library configuration is environment dependency which is not maintained in Source Version Control, we have to manually setup the library configuration in the build machine. And always synchronize it with development machine, which is again tedious.
3. The library manager at least should support export and import functions. So that instead of doing this kind of hacking, user can do it from UI. The hack has potential risk such as configuration file format in-compatibility between different versions.

By Top8: (2008-JAN-28) I have used this approach in many platform upgrades, and it always worked. Thank you for that. I can live without the GUI, but I always forget where the config files are. This articles gives you the exact location.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo