{
  "id": "java/unsupported-major-minor-version",
  "signature": "java.lang.UnsupportedClassVersionError: org/example/MyClass has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 52.0",
  "signature_zh": "java.lang.UnsupportedClassVersionError: org/example/MyClass 由更高版本的 Java 运行时编译（类文件版本 61.0），此 Java 运行时仅识别最高版本 52.0 的类文件",
  "regex": "java\\.lang\\.UnsupportedClassVersionError:.*has been compiled by a more recent version of the Java Runtime.*class file version \\d+\\.\\d+",
  "domain": "java",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The compiled class file has a major version (e.g., 61 for Java 17) higher than what the running JVM supports (e.g., 52 for Java 8), indicating a mismatch between compile-time and runtime Java versions.",
  "root_cause_type": "generic",
  "root_cause_zh": "编译的类文件的主版本（例如 Java 17 的 61）高于正在运行的 JVM 支持的版本（例如 Java 8 的 52），表明编译时和运行时的 Java 版本不匹配。",
  "versions": [
    {
      "version": "Java 8 (class version 52.0)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 11 (class version 55.0)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 17 (class version 61.0)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 21 (class version 65.0)",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Set JAVA_HOME to an older JDK version and recompile",
      "why_fails": "This downgrades the runtime but the compiled classes still have the higher version; the error occurs at runtime, not compile time.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add --release flag to the compiler without changing the JDK",
      "why_fails": "The --release flag only works if the correct JDK version is used; using it with an older JDK may still produce incompatible class files.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Delete the JAR file and rebuild with same JDK",
      "why_fails": "If the build environment hasn't changed, the same version mismatch will persist.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Upgrade the runtime JVM to match the compilation version. For example, if class version is 61.0, run with Java 17 or later. Set JAVA_HOME and update PATH accordingly.",
      "success_rate": 0.95,
      "how": "Upgrade the runtime JVM to match the compilation version. For example, if class version is 61.0, run with Java 17 or later. Set JAVA_HOME and update PATH accordingly.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Recompile the source code with a lower target version using javac -source 8 -target 8 (or --release 8) if the source is available.",
      "success_rate": 0.9,
      "how": "Recompile the source code with a lower target version using javac -source 8 -target 8 (or --release 8) if the source is available.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a dependency management tool like Maven to enforce a consistent Java version across modules by setting <maven.compiler.source> and <maven.compiler.target> properties.",
      "success_rate": 0.85,
      "how": "Use a dependency management tool like Maven to enforce a consistent Java version across modules by setting <maven.compiler.source> and <maven.compiler.target> properties.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Upgrade the runtime JVM to match the compilation version. For example, if class version is 61.0, run with Java 17 or later. Set JAVA_HOME and update PATH accordingly.",
    "Recompile the source code with a lower target version using javac -source 8 -target 8 (or --release 8) if the source is available.",
    "Use a dependency management tool like Maven to enforce a consistent Java version across modules by setting <maven.compiler.source> and <maven.compiler.target> properties."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/UnsupportedClassVersionError.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.92,
  "resolvable": "true",
  "first_seen": "2023-03-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}