简体   繁体   中英

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.

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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