java - 如何解决Ubuntu 18.04中Eclipse无法找到artifact com.sun :tools:jar:1. 0.0的错误

标签 java maven

我将一个 Maven 项目导入到 Eclipse 中,并在 pom.xml 中出现以下错误:

Could not find artifact com.sun:tools:jar:1.0.0 at specified path /usr/lib/jvm/java-11-openjdk-amd64/../lib/tools.jar

我的操作系统是Ubuntu 18.04,Java版本是

openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)

问题是否是因为 tools.jar 不在 /usr/lib/jvm/java-11-openjdk-amd64/lib 中?如果是这样,我在哪里可以找到这个tools.jar

最佳答案

tools.jar 库已在 Java 9 中作为 JEP 220 的一部分被删除。 。此 jar 中的编译器工具已移至 JDK 的 lib 文件夹中。

处理此问题的最佳方法是将需要 tools.jar 的依赖项升级为与 Java 9+ 兼容的版本。

除此之外,您也许能够在 javac.compiler 模块中找到所需的类,但这条路充满了危险(或者至少令人心痛)。

关于java - 如何解决Ubuntu 18.04中Eclipse无法找到artifact com.sun :tools:jar:1. 0.0的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58367082/

相关文章:

java - 如何清除 spring 中的 ehcache 对象以编程方式配置 java 项目

java - Maven Eclipse : How to include custom folder (with files) into the "target" folder on build?

eclipse - 从 pom.xml 设置事件 Spring 配置文件并与 IDE 集成

java - Spring Sleuth 和 Zipkin :Could not find artifact io. zipkin.brave :brave-bom:pom:4. 16.3-SNAPSHOT

jsp - Maven 编译/安装更改 JSP 内容

Maven安装失败: Install doesn't see packaged artifact

java - 如何告诉 Spring 在不提供构造函数参数的情况下实例化选定的 bean?

java - JDK6.0 或其他库中有Concurrent LinkedHashSet 吗?

java - 如何在外部存储中创建目录?

java - Bigquery java api 无法加载数据 - "file does not exist on cloud"