简体   繁体   English

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

[英]How can I resolve “sun.security.x509” is not visible when migrating from 1.8 to openJDK11?

I am migrating Java 1.8 to OpenJDK 11. Getting some dependency errors.我正在将 Java 1.8 迁移到 OpenJDK 11。遇到一些依赖性错误。

  1. "sun.security.x509" is not visible. “sun.security.x509”不可见。
  2. BASE64Encoder error BASE64编码器错误

How can I resolve these?我该如何解决这些问题? I am using Apache Ant for build.我正在使用 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.我们无法告诉您如何解决第一个问题,因为您没有向我们展示您在sun.security.x509 package 中使用类的代码。 A possible workaround might be to use --add-exports and/or --add-opens as described in this blog post:一种可能的解决方法可能是使用--add-exports和/或--add-opens ,如本博客文章中所述:

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. 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.我正在使用 Apache Ant 进行构建。

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.问题的根本原因在于您正在构建的代码而不是您正在使用的构建工具。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM