如何解决从1.8迁移到openJDK11时出现”sun.security.x509″不可见的问题?

huangapple 未分类评论50阅读模式
英文:

How can I resolve "sun.security.x509" is not visible when migrating from 1.8 to openJDK11?

问题

我正在将Java 1.8迁移到OpenJDK 11。遇到了一些依赖错误。

  1. "sun.security.x509"不可见。
  2. BASE64Encoder错误

我该如何解决这些问题?我在使用Apache Ant进行构建。

英文:

I am migrating Java 1.8 to OpenJDK 11. Getting some dependency errors.

  1. "sun.security.x509" is not visible.
  2. BASE64Encoder error

How can I resolve these? I am using Apache Ant for build.

答案1

得分: 0

我们无法告诉您如何解决第一个问题,因为您还没有向我们展示您在sun.security.x509包中使用类的代码。一个可能的解决方法 可能 是使用如下博客文章中描述的 --add-exports 和/或 --add-opens

然而,这种解决方法可能在将来停止工作。解决方案是找到一种不依赖于这些类的方法。

第二个问题可以通过重写您的代码以使用在Java 8中引入的 java.util.Base64 类 (javadoc) 来解决。

> 我正在使用Apache Ant进行构建。

这与问题并不直接相关。问题的根本原因在于您正在构建的代码,而不是您正在使用的构建工具。

英文:

We can't tell you how to address the first problem since you haven't shown us the code where you are using classes in the sun.security.x509 package. A possible workaround might be to use --add-exports and/or --add-opens as described in this blog post:

However, that work-around is liable to stop working in the future. The solution would be to find a way to avoid depending on those classes.

The second problem can be used by rewriting your code to use the java.util.Base64 class (javadoc) that was introduced in Java 8.


> I am using Apache Ant for build.

That is not directly relevant. The root cause of the problem is in the code you are building not the build tool you are using.

huangapple
  • 本文由 发表于 2020年5月19日 19:02:54
  • 转载请务必保留本文链接:https://java.coder-hub.com/61889478.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定