Directories in Netbeans: Install, User and Projects

The following are the three (major) directories used by Netbeans:

  • Installation Directory. The directory where ide is installed and run from.
  • User Directory. The directory where user settings are stored.
  • Projects directory. The directory where a netbeans project is stored. Each project has its own project directory.Introduced since nb4.

Recommendations:

  • Keep the directories separate. For instance, it is possible to create the projects in user directory but not advisable. Keeping the directories separate allows you to get rid of any one of them without loosing other data. For instance, if for some reason, the ide install directory gets corrupted, then the ide can be reinstalled but the existing user settings and projects can be reused with the new install. Similarly if the userdir gets corrupted, then the ide can be run with a fresh userdir without the need to reinstall the ide and existing projects can be opened in the ide.
  • Organize your projects under one master directory. Though the ide itself does not enforce this (and correctly so), you may want to create a top-level folder for all of your projects and arrange your projects within this folder. This may be especially useful when the projects have to be maintained in a source control system.
    • Keep the sources separate from the project directory, by changing the source folders property in the project properties dialog. This way the project can always be deleted and recreated.
  • If you reinstall the ide and run into issues while running it, the most probable reason is that the older user directory has some conflicting settings; try running the ide with a different userdir, as specified in the section below.

User Directory

  • How to find the current user directory? Run the ide and open the about box (Help | About) and switch to 'Details' tab. You will notice an entry for userdir.
  • If you are unable to run the ide even: Check the [ideinstalldir]/etc/*.conf file. There should be entry called "netbeans_default_userdir".
  • Sometimes the user directory may get corrupted resulting in strange behaviour (like settings not getting saved etc). In such cases:
    • Run the ide with a fresh userdir as "[netbeans_install_dir]/bin/netbeans.exe --userdir [path_to_non_existent_dir]". As an example, [path_to_non_existent_dir] can be "c:\temp\myuserdir". The ide will create the [path_to_non_existent_dir] and use it as the user directory for that session.
    • Run the IDE and note down the usedir from the Details tab in the About box as specified in the blog. Close the IDE. Open the Windows Explorer and rename the [userdir] to something like [userdir].bkp. Run the IDE via the standard desktop icon or start menu item. The IDE will find that the [userdir] does not exist and will create [userdir]. If you do not wish to save the current user directory, simply delete the directory. The ide will recreate the directory upon next startup.
    • Modify the user directory value in the conf file to permanantly set the userdir to a different directory.
  • It is possible to have several user directories with different settings and to switch between them using "--userdir" option while invoking the ide.

In addition to the above directories, some modules use the user's home directory (${HOME}) to store some settings. These are usually done when a module needs to store information that is valid no matter what the current user directory may be (the same ide install can be run with different user directories with '--userdir' parameter). The module could of course store this in the ide-install directory; but not all users may have writable access to the ide-install directory. So, to solve the problem of storing data that is not really user-specific but cannot be written to ide-install directory due to permission issues, modules may choose to store data in ${HOME} directory.

For instance:

Registration module creates .netbeans-registration directory in ${HOME}. Deleting this directory is safe; it will of course bring up the registration dialog again (and create .netbeans-registration again).

Profiler module creates .nbprofiler directory in ${HOME} to collect and store machine-specific data that is common to all users (so that this step need not be repeated for fresh user directories). Deleting this directory should be safe; the directory will be recreated next time.

Ref: http://blogs.sun.com/karthikr/entry/jse_directories

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by radhika