UserdirAndCachedirFoldersInSystemSpecificPaths

--cachedir

In 7.1 a new command-line option "--cachedir" has been introduced to allow optional separate path for the cache part of user data previously stored in var/cache/ subfolder in userdir.

Different defaults for userdir and cachedir paths on different systems

Issue Issue 196075Image:Yes.png deals with separating the preferences part of userdir and the cache part into two different locations as a new default behavior on Windows. The motivation is to start storing user data under the Windows-specific standard path (under <AppData> and <Local AppData> folders) and to improve performance for roaming user profiles by separating the huge cache part into the non-roaming folder (<Local AppData>).

The change being prepared also aims to pick more suitable defaults for Mac OS-X and Linux users.

The following changes will need to be introduced for the path change:

  • netbeans.conf variables for default userdir and cachedir paths
# On Windows ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with a path to "<AppData>/NetBeans" folder where <AppData> is user's
# value of AppData key in Windows Registry under
#   Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
# ${DEFAULT_CACHEDIR_ROOT} will be replaced by the launcher
# with a path to "<Local AppData>/NetBeans/Cache" folder where <Local AppData>
# is user's value of Local AppData key in Windows Registry under
#   Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders
#
# On Mac ${DEFAULT_USERDIR_ROOT} will be replaced by the launcher
# with a path to ~/Library/Application Support/NetBeans
# ${DEFAULT_CACHEDIR_ROOT} with a path to ~/Library/Caches/NetBeans
#
# On other systems ${DEFAULT_USERDIR_ROOT} will be replaced with
# a path to ~/.netbeans folder in user's home and
# ${DEFAULT_CACHEDIR_ROOT} with a path to ~/.cache/netbeans folder.
#
# You can also use ${HOME} which will be replaced by user.home
# system property.
#
# NOTE: If you specify a non-default userdir path, the cachedir path
# will be mapped to <userdir>/var/cache folder.
#
netbeans_default_userdir="${DEFAULT_USERDIR_ROOT}/version"
netbeans_default_cachedir="${DEFAULT_CACHEDIR_ROOT}/version"
  • Windows netbeans.exe launcher - retrieves AppData and Local AppData keys from Windows registry and uses these paths to resolve the userdir and cachedir paths iff they do contain ${DEFAULT_USERDIR_ROOT} and ${DEFAULT_CACHEDIR_ROOT} variables - it passes the resulting paths to nbexec.exe as --userdir and --cachedir parameters Image:Yes.png
  • Unix/Mac netbeans launcher - resolves the userdir and cachedir paths iff they do contain ${DEFAULT_USERDIR_ROOT} and ${DEFAULT_CACHEDIR_ROOT} variables with
    • on Mac - ${DEFAULT_USERDIR_ROOT} is ~/Library/Application Support/NetBeans and ${DEFAULT_CACHEDIR_ROOT} is ~/Library/Caches/NetBeans (Important Java Directories on Mac OS X) Image:Yes.png
    • otherwise - the paths to ~/.netbeans and ~/.cache/netbeans - it passes the resulting paths to nbexec as --userdir and --cachedir parameters Image:Yes.png
  • installer - tracked as Issue 207501 Image:Yes.png
    • installer/mac/newbuild/netBeans/baseide/pkg/scripts/servicetag.sh - changes ownership of .superId on Mac
    • installer/engine/src/org/netbeans/installer/wizard/components/actions/netbeans/NbShowUninstallationSurveyAction.java - reads superId from .netbeans directory Image:Yes.png


  • uninstaller will allow removing userdir (asking the user with the checkbox as before), cachedir folder will be removed automatically without asking - the paths will be resolved using the same mechanism as in the launchers Image:Yes.png
  • autoupdate.services - no change needed
  • autoupdate.ui - contains hardcoded ".netbeans" as default home for all userdirs - it is using the path to create/read superId file - needs to be able to read the old location until it creates the file (by copying the old one) in the new location at ${DEFAULT_USERDIR_ROOT} - the location could be resolved using the new API's Places.getUserDirectory().getParentFile() and possibly first checking Places.userDirectory.name =~ /dev|[0-9.]+/ to be sure we are looking into the default userdir root
  • reglib - a part of NBI Engine - uses hardcoded ".netbeans" as well, reading/creating superId file -- dtto above
  • autoupdate.pluginimporter - contains hardcoded ".netbeans/6.9", ".netbeans/6.8" etc. to check for the previous installations - needs to start looking at the new paths for upcoming releases
  • o.n.upgrader - contains hardcoded ".netbeans/6.9", ".netbeans/6.8" etc. to check for the previous installations - needs to start looking at the new paths for upcoming releases
  • options.api - uses "user.home" property as a default root dir for all userdirs (Import Dialog) - needs to be able to read both old and new paths

Connected tasks

  • avoid IDE to run more userdirs with as same cachedir - Issue 208190
  • Affected Docs - ???

Also other NetBeans related paths are now stored directly in user's home and need to be moved to AppData folder on Windows (Issue 49813).

  • .nbi - move under AppData/NetBeans Installer - TBD if the old .nbi folder is to be preserved for older installations - Issue 207506
  • .netbeans-derby - move under AppData/NetBeans/Derby - Issue 207507
  • .netbeans-registration - no need to change, not used anymore
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