Revert `bootstrap_runtime_toolchain_type` changes

Copybara Import from https://github.com/bazelbuild/rules_java/pull/246

BEGIN_PUBLIC
Revert `bootstrap_runtime_toolchain_type` changes (#246)

This reverts the relevant bits from bcc506228f3ac2c6a811c3414329d8727883685e and 30ecf3ff. The minimum supported Bazel version is now 6.4.0 which includes the type in `@bazel_tools`.

Closes #246
END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/246 from bazelbuild:hvd_tests_for_bootclasspath b666dc289edac950f006b81452193a4dcc91592a
PiperOrigin-RevId: 702260069
Change-Id: Ie64994873a7b5609d4fb8b12a2472c82eb71493b
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
index efeeef1..0f796c9 100644
--- a/.bazelci/presubmit.yml
+++ b/.bazelci/presubmit.yml
@@ -120,12 +120,12 @@
 # Bazel 6.x
   ubuntu2004_bazel6:
     name: "Bazel 6.x"
-    bazel: 6.3.0
+    bazel: 6.4.0
     platform: ubuntu2004
     build_targets: *build_targets_bazel6
   ubuntu2004_integration_bazel6:
     name: "Bazel 6.x Integration"
-    bazel: 6.3.0
+    bazel: 6.4.0
     platform: ubuntu2004
     working_directory: "test/repo"
     shell_commands:
@@ -137,11 +137,11 @@
     - "//:MyTest"
   macos_bazel6:
     name: "Bazel 6.x"
-    bazel: 6.3.0
+    bazel: 6.4.0
     platform: macos
     build_targets: *build_targets_bazel6
   windows_bazel6:
     name: "Bazel 6.x"
-    bazel: 6.3.0
+    bazel: 6.4.0
     platform: windows
     build_targets: *build_targets_bazel6
diff --git a/MODULE.bazel b/MODULE.bazel
index b14fcbf..bf7568d 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,7 +1,7 @@
 module(
     name = "rules_java",
     version = "8.5.1",
-    bazel_compatibility = [">=6.3.0"],
+    bazel_compatibility = [">=6.4.0"],
     compatibility_level = 1,
 )
 
diff --git a/test/repo/BUILD.bazel b/test/repo/BUILD.bazel
index c1482da..7f6887a 100644
--- a/test/repo/BUILD.bazel
+++ b/test/repo/BUILD.bazel
@@ -26,4 +26,5 @@
 
 default_java_toolchain(
     name = "my_funky_toolchain",
+    bootclasspath = ["@bazel_tools//tools/jdk:platformclasspath"],
 )
diff --git a/test/repo/WORKSPACE b/test/repo/WORKSPACE
index aa3b7cb..1a135b6 100644
--- a/test/repo/WORKSPACE
+++ b/test/repo/WORKSPACE
@@ -13,6 +13,8 @@
 
 proto_bazel_features(name = "proto_bazel_features")
 
+register_toolchains("//:all")
+
 load("@rules_java//java:repositories.bzl", "rules_java_toolchains")
 
 rules_java_toolchains()
diff --git a/toolchains/BUILD b/toolchains/BUILD
index ffbffc4..e7f4d84 100644
--- a/toolchains/BUILD
+++ b/toolchains/BUILD
@@ -67,8 +67,8 @@
 #
 # Toolchains of this type are only consumed internally by the bootclasspath rule and should not be
 # accessed from Starlark.
-
-toolchain_type(name = "bootstrap_runtime_toolchain_type")
+# TODO: migrate away from using @bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type ?
+# toolchain_type(name = "bootstrap_runtime_toolchain_type")
 
 # Points to toolchain[":runtime_toolchain_type"] (was :legacy_current_java_runtime)
 java_runtime_alias(name = "current_java_runtime")
diff --git a/toolchains/default_java_toolchain.bzl b/toolchains/default_java_toolchain.bzl
index 75d05f7..5aaa06b 100644
--- a/toolchains/default_java_toolchain.bzl
+++ b/toolchains/default_java_toolchain.bzl
@@ -213,7 +213,7 @@
             tags = ["manual"],
         )
 
-_JAVA_BOOTSTRAP_RUNTIME_TOOLCHAIN_TYPE = Label("//toolchains:bootstrap_runtime_toolchain_type")
+_JAVA_BOOTSTRAP_RUNTIME_TOOLCHAIN_TYPE = Label("@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type")
 
 # Opt the Java bootstrap actions into path mapping:
 # https://github.com/bazelbuild/bazel/commit/a239ea84832f18ee8706682145e9595e71b39680
diff --git a/toolchains/local_java_repository.bzl b/toolchains/local_java_repository.bzl
index 17b1a0e..627f8ab 100644
--- a/toolchains/local_java_repository.bzl
+++ b/toolchains/local_java_repository.bzl
@@ -110,7 +110,7 @@
     native.toolchain(
         name = "bootstrap_runtime_toolchain_definition",
         target_settings = [":%s_settings_alias" % name],
-        toolchain_type = Label("//toolchains:bootstrap_runtime_toolchain_type"),
+        toolchain_type = Label("@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type"),
         toolchain = runtime_name,
     )
 
@@ -268,7 +268,7 @@
 toolchain(
    name = "bootstrap_runtime_toolchain_definition",
    target_settings = [":localjdk_setting"],
-   toolchain_type = "@rules_java//toolchains:bootstrap_runtime_toolchain_type",
+   toolchain_type = "@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type",
    toolchain = ":jdk",
 )
 '''
diff --git a/toolchains/remote_java_repository.bzl b/toolchains/remote_java_repository.bzl
index a2535d3..65bbe48 100644
--- a/toolchains/remote_java_repository.bzl
+++ b/toolchains/remote_java_repository.bzl
@@ -89,7 +89,7 @@
     # the same configuration, this constraint will not result in toolchain resolution failures.
     exec_compatible_with = {target_compatible_with},
     target_settings = [":version_or_prefix_version_setting"],
-    toolchain_type = "@rules_java//toolchains:bootstrap_runtime_toolchain_type",
+    toolchain_type = "@bazel_tools//tools/jdk:bootstrap_runtime_toolchain_type",
     toolchain = "{toolchain}",
 )
 """.format(