public static File getConfigFile(String fileName) throws
            NoConfigFileFoundException
      {
        for (int i = 0; i < CONFIG_LOCATIONS.length; i++)
          {
            String location = CONFIG_LOCATIONS[i];
            if (location.startsWith("%HOME%"))
              {
                if (isUnix())
                  {
                    String home = getUserHome();
                    if (home == null || home.length() <= 0)
                      {
                        continue;
                      }
                    location = location.replace("%HOME%", home);
                  } else
                  {
                    continue;
                  }
              }
            File dir = new File(location);
            if (!dir.isDirectory() || !dir.exists())
              {
                continue;
              }
            File configFile = new File(dir, fileName);
            if (!configFile.exists() || !configFile.canRead())
              {
                continue;
              }
            return configFile;

          }
        throw new NoConfigFileFoundException();
      }