Bootstrap using JDK21.

PiperOrigin-RevId: 630051757
Change-Id: I7462eb9bc9b553e31f97d8b66dbc761c8ff1c639
diff --git a/scripts/bootstrap/BUILD.bootstrap b/scripts/bootstrap/BUILD.bootstrap
index a75e906..35b1a60 100644
--- a/scripts/bootstrap/BUILD.bootstrap
+++ b/scripts/bootstrap/BUILD.bootstrap
@@ -19,8 +19,8 @@
         "-XX:TieredStopAtLevel=1",
     ],
     singlejar = ["//src/tools/singlejar:singlejar"],
-    source_version = "8",
+    source_version = "21",
     tags = ["manual"],
-    target_version = "8",
+    target_version = "21",
     visibility = ["//visibility:public"],
 )
diff --git a/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh b/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
index 1db391f..29b677d 100755
--- a/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
+++ b/src/test/shell/bazel/bazel_bootstrap_distfile_test.sh
@@ -102,8 +102,13 @@
 
     JAVABASE=$(echo reduced*)
 
-    env EXTRA_BAZEL_ARGS="--tool_java_runtime_version=local_jdk" ./compile.sh \
-        || fail "Expected to be able to bootstrap bazel. If you updated MODULE.bazel, see the NOTE in that file."
+    env EXTRA_BAZEL_ARGS="--java_runtime_version=21 \
+      --java_language_version=21 \
+      --tool_java_runtime_version=21 \
+      --tool_java_language_version=21" \
+      ./compile.sh \
+      || fail "Expected to be able to bootstrap bazel.\
+ If you updated MODULE.bazel, see the NOTE in that file."
 
     ./output/bazel \
       --server_javabase=$JAVABASE --host_jvm_args=--add-opens=java.base/java.nio=ALL-UNNAMED \