How to get java8 code that uses Unsafe running on jdk8 and jdk9?

I use sun.misc.UnsafeJava8 in my code base. This does not work on Java9.

I would like to have a fix for Java9, but with the same code base that runs on Java8. If I put module-info.javathis will not work, since my code base is Java8.

What to do?

+4
source share
1 answer

Andreas comment points in the right direction, you can use Multi-Release JAR Files .

​​, , JDK Java, JAR, , , , META-INF//9. JEP: -

  • JDK, MRJAR, .

  • JDK, MRJAR, , Java-, ; Java, Java, , , root JAR.

  • , Java 9 JDK , JAR- , 9, JAR; Java 8 JDK JAR.

: - , JetBrains IntelliJ2017.3.

+2

Source: https://habr.com/ru/post/1690184/


All Articles