Java 如何在 Windows 上获取 OpenJDK 11 的 tools.jar?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53707666/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 00:52:47  来源:igfitidea点击:

How to get tools.jar for OpenJDK 11 on Windows?

javamavenhadoopjava-11tools.jar

提问by R Y

Background: I am trying to build Hadoop for Windows using instructions found here. I have OpenJDK 11and have ran into the following issue while running mvn package:

背景:我正在尝试使用此处找到的说明为 Windows 构建 Hadoop 。我有OpenJDK 11并且在运行时遇到了以下问题mvn package

Could not resolve dependencies for project org.apache.hadoop:hadoop-annotations:jar:2.5.0-SNAPSHOT: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path C:\Program Files\Java\jdk-11.0.1\..\lib\tools.jar

Could not resolve dependencies for project org.apache.hadoop:hadoop-annotations:jar:2.5.0-SNAPSHOT: Could not find artifact jdk.tools:jdk.tools:jar:1.6 at specified path C:\Program Files\Java\jdk-11.0.1\..\lib\tools.jar

I realised no tools.jarexists in the Windows build of OpenJDK 11. Would I have to build this from source as well? How can I get the tools.jarMaven artefact for OpenJDK 11?

我意识到tools.jarOpenJDK 11 的 Windows 版本中不存在。我是否也必须从源代码构建它?如何获取tools.jarOpenJDK 11的Maven 人工制品?

采纳答案by Edwin Buck

It was removed in JDK 9.

它在 JDK 9 中被删除。

JEP 220 removed the well-known and frequently-referenced JARs rt.jar and tools.jar. According to it's description, "The class and resource files previously stored in lib/rt.jar, lib/tools.jar, lib/dt.jar, and various other internal jar files will now be stored in a more efficient format in implementation-specific files in the lib directory.

JEP 220 删除了众所周知且经常引用的 JAR rt.jar 和 tools.jar。根据它的描述,“以前存储在 lib/rt.jar、lib/tools.jar、lib/dt.jar 和各种其他内部 jar 文件中的类和资源文件现在将在实现中以更高效的格式存储- lib 目录中的特定文件。

I suggest you use a updated version of Apache Hadoop, or if the updated version also doesn't support Java 11, downgrade your Java to 1.8.

我建议您使用更新版本的 Apache Hadoop,或者如果更新版本也不支持 Java 11,请将您的 Java 降级到 1.8。

For example, the current stable Apache Hadoop is version 2.9.2, and in its instructions on how to install, it specifically references JDKs before JDK 9. For its proper support, I suggest you use OpenJDK 1.8

比如目前Apache Hadoop的稳定版本是2.9.2,在安装说明中专门引用了JDK 9之前的JDK。为了得到适当的支持,建议你使用OpenJDK 1.8

There is a Hadoop 3.1.1, and if you find the Java version is critical to your success, I'd look into that.

有一个 Hadoop 3.1.1,如果您发现 Java 版本对您的成功至关重要,我会研究一下。