Home > Software Development > Hack Workspace in Netbeans IDE

Hack Workspace in Netbeans IDE

As a long time Eclipse user, I like its workspace concept and the ease of switching workspaces among many other things. The workspace provides a simple yet powerful way to isolate groups of projects into different workspaces under different folders, so you’re not distracted by other un-related projects.

This feature is, however, not available in Netbeans IDE, which is not a big deal most of time. By default, the Netbeans IDE creates a folder under current user’s home directory as follows (yours could be different):

Lost VMs or Containers? Too Many Consoles? Too Slow GUI? Time to learn how to "Google" and manage your VMware and clouds in a fast and secure HTML5 App.

C:\Users\sjin\Documents\NetBeansProjects

I’ve been using that default location since using Netbeans until recently when I needed to move the default folder to a network drive for backup purpose. After researching on the Web, it turns out it’s not too difficult to change the default location to another directory with a little hack. The default project location is stored in a well-know properties file in a path as follows:

C:\Users\sjin\.netbeans\7.1.2\config\Preferences\org\netbeans\modules\projectui.properties

Note that the user name and version number may vary in your environment. Also, the file may not exist before Netbeans runs for the first time. In that case, you can manual create one.

Within the properties file are many key/value pairs with “=” in between as below. Remove all of them, and add the following line:

projectsFolder=Y:\\NetbeanProjects

When the Netbeans starts, it loads the projects under that folder. Note that the folder should be created before Netbeans starts or it defaults back to system default. Once it runs, it may add many more key/value pairs in the properties file.

To hack the switching of workspaces, you can copy the projectui.properties and rename it to something meaningful like projectui_HadoopDev.properties, or projectui_vCenterPlugin.properties.  Each one of the properties file corresponds to a workspace you want to keep.

While switching “workspace” to Hadoop development, you just rename projectui_HadoopDev.properties to projectui.properties. Don’t forget to save the existing projectui.properties to a different name. The Netbeans IDE picks up the new workspace after starting up.

This hack works fine but I wouldn’t recommend doing it frequently as the manual copying/renaming can be error prone and when that happens it may mess up the projects. For simple projects grouping, you can consider the existing “Project Group” feature of Netbeans IDE.

  1. Esteban Aliverti
    July 26th, 2012 at 02:43 | #1

    In Netbeans you also have the concept of ‘Project Groups’ that you can use to group related projects together. Switching from one group to another can be done without having to restart the IDE.

  2. Esteban Aliverti
    July 26th, 2012 at 02:44 | #2

    Ups.. sorry. I had’t read the last part of your post :)

  3. July 26th, 2012 at 19:20 | #3

    No worry Esteban, thanks for sharing your thoughts!
    Steve

  4. September 11th, 2012 at 04:02 | #4

    I´m glad to have found your site. Thanks for sharing your great articles

  5. September 13th, 2012 at 17:49 | #5

    You are welcome Yasmin, I am glad you found it useful.
    Steve

  6. Jesse Chisholm
    August 19th, 2015 at 17:05 | #6

    If you want to move a Project Group, then do this:

    (1.) Edit C:\Users\...\netbeans\modules\projectui\groups\TheGroup.properties
    (2.) Change the value of the path entry
    (3.) Move (or copy if you are paranoid) your project tree to the new location.
    (4.) Open NetBeans
    (5.) Use File / Project Groups … to ensure you are working with the group you think you are.

  7. August 21st, 2015 at 11:33 | #7

    Thanks for sharing Jesse! Will try it out. -Steve

  1. No trackbacks yet.