Use hermetic Java runtimes

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

BEGIN_PUBLIC
Use hermetic Java runtimes (#241)

Makes it easier to contribute to the project while ensuring that it remains compatible with Java 8.

Closes #241
END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/241 from fmeum:hermetic-ci 1cd4a4d8bd880889b7fe8b711abda5bebed69024
PiperOrigin-RevId: 696820025
Change-Id: I166118e9814b1e0bde93c95e4e9ff9a6e05a49c4
diff --git a/.bazelrc b/.bazelrc
index 5ef382d..526b36d 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1 +1,10 @@
 common --incompatible_disallow_empty_glob
+
+# Use hermetic JDKs for testing and ensure compatibliity with Java 8.
+common --java_language_version=8
+common --java_runtime_version=remotejdk_8
+common --tool_java_language_version=8
+common --tool_java_runtime_version=remotejdk_8
+
+# Hide Java 8 deprecation warnings.
+common --javacopt=-Xlint:-options