public static boolean hasValidJarContent(File jarFile) {
    boolean valid = false;

    try (FileInputStream fileInputStream = new FileInputStream(jarFile);
        JarInputStream jarInputStream = new JarInputStream(fileInputStream)) {
      valid = jarInputStream.getNextJarEntry() != null;
    } catch (IOException ignore) {
      // Ignore this exception and just return false
    }

    return valid;
  }
Peek into the JAR data and make sure that it is valid JAR content.

@param jarFile Jar containing data to be validated.
@return True if the data has JAR content, false otherwise
geode-management/src/main/java/org/apache/geode/management/internal/utils/JarFileUtils.java