[7.2.0-1] "LinkageError occurred while loading main class" due to java version

Description:

I'm seeing the following error when running the latest version of Bazel.

Error: LinkageError occurred while loading main class com.google.devtools.build.lib.bazel.Bazel
	java.lang.UnsupportedClassVersionError: com/google/devtools/build/lib/bazel/Bazel has been compiled by a more recent version of the Java Runtime (class file version 65), this version of the Java Runtime only recognizes class file versions up to 55.0

Additional info:

  • package version(s): 7.2.0-1
  • link to upstream bug report, if any: No upstream issue, and Bazel works as expected using bazelisk-1.20.0-2 which downloads 7.2.1 from head. Slightly different version, but I couldn't find an upstream issue. Didn't verify on 7.2.0

Steps to reproduce:

  1. Switch to a bazel workspace root
  2. Run bazel info