public static int getJavaMajorVersion() {
    return Math.max(8, Integer.parseInt(
        System.getProperty("java.specification.version").split("\\.")[0]));
  }
Returns the detected Java major version (e.g., 8, 11, 17).
common/src/java/org/apache/hadoop/hive/common/JavaVersionUtils.java