code: public static File getUserHomeDir() {
          final String errMsg = "System property '" + USER_HOME_KEY + "'";
          final String str = System.getProperty(USER_HOME_KEY);
          if (str == null) {
              throw new IllegalStateException(errMsg + " not found!");
          }
          final String userHome = str.trim();
          if (userHome.length() == 0) {
              throw new IllegalStateException(errMsg + " is empty!");
          }
          final File dir = new File(userHome);
          try {
              checkValidDir(dir);
          } catch (final IllegalArgumentException ex) {
              throw new IllegalStateException(errMsg + " is not valid! [" + ex.getMessage() + "]");
          }
          return dir;
      }
docs: Returns the user home directory and checks if it is valid and exists. If not a <code>IllegalStateException</code> is thrown.
  
  @return Directory.