code: public static List<String> getResourcesList(String path) {
      Set<String> resList = new HashSet<>(); // subdirectories can cause duplicate entries
      try {
        // Java doesn't allow simple exploration of resources as directories
        // when the resources are inside a jar file. This searches the contents
        // of the jar to get the list
        URL classUrl = JarHash.class.getResource("/water/H2O.class");
        if (classUrl != null && classUrl.getProtocol().equals("jar")) {
          // extract jarPath from classUrl string
          String jarPath = classUrl.getPath().substring(5, classUrl.getPath().indexOf("!"));
          JarFile jar = new JarFile(URLDecoder.decode(jarPath, "UTF-8"));
          Enumeration<JarEntry> files = jar.entries();
          // look for all entries within the supplied resource path
          while (files.hasMoreElements()) {
            String fName = files.nextElement().getName();
            if (fName.startsWith(path + "/")) {
              String resourceName = fName.substring((path + "/").length());
              int checkSubdir = resourceName.indexOf("/");
              if (checkSubdir >= 0) // subdir, trim to subdir name
                resourceName = resourceName.substring(0, checkSubdir);
              if (resourceName.length() > 0) resList.add(resourceName);
            }
          }
        } else { // not a jar, retrieve resource from file system
          String resourceName;
          BufferedReader resources = new BufferedReader(new InputStreamReader(JarHash.class.getResourceAsStream("/gaid")));
          if (resources != null) {
            while ((resourceName = resources.readLine()) != null)
              if (resourceName.length() > 0)
                resList.add(resourceName);
          }
        }
      }catch(Exception ignore){
        Log.debug("Failed in reading gaid resources.");
      }
      return new ArrayList<>(resList);
    }
docs: Given a path name (without preceding and appending "/"),
  return the names of all file and directory names contained
  in the path location (not recursive).
  
  @param path - name of resource path
  @return - list of resource names at that path