code: public static File getSystemDirectory( String applicationname )
          throws EnvironmentException
      {
          if( isUnix() )
          {
              String name = applicationname.toLowerCase();
              String dirname = "/home/" + USERNAME + name;
              File homeDir = new File( dirname );
              if( homeDir.exists() )
              {
                  return homeDir;
              }
              dirname = "/usr/share/" + name;
              File shareDir = new File( dirname );
              if( shareDir.exists() )
              {
                  return shareDir;
              }
              if( "root".equals( USERNAME ) )
              {
                  return shareDir;
              }
              else
              {
                  return homeDir;
              }
          }
  
          if( isWindows() )
          {
              String name = toFirstCap( applicationname );
              String shared = getEnvVariable( "PROGRAMFILES" );
              if( shared == null )
              {
                  shared = "C:\\Program Files\\";
              }
              File dir = new File( shared, name );
              return dir;
          }
          String message = "Environment operations not supported on unrecognized operatings system";
          UnsupportedOperationException cause = new UnsupportedOperationException( message );
          throw new EnvironmentException( cause );
      }
docs: Returns the System directory of the application for the logged in user.
  This method returns the directory where the application should be, or has been installed,
  on the system, for the current user. On Unix systems, the following rules are applied;
  <ol>
  <li>applicationname is made into lowercase.
  <li>application is looked for in the $HOME/<i>applicationname</i></li>
  <li>application is looked for in the /usr/share/<i>applicationname</i></li>
  <li>if the $USER == 'root', then use /usr/share/<i>applicationname</i></li>
  <li>use $HOME/<i>applicationname</i></li>
  </ol>
  On Windows, the PROGRAMFILES environment variable is looked up, if not found, then use "C:\Program Files\"
  and then append the <i>applicationname</i> with an initial uppercase character.
  
  @param applicationname The name of the application.
  
  @return The directory where the application is either installed or can be installed.
  
  @throws EnvironmentException if the current system in not Windows or Unix/Linux.