JavaLangAccess and SharedSecrets in Java 9
java, java-9
Solution
Both the above classes are packaged in `jdk.internal.misc` package.
One way you can try and access them is by using the option
--add-exports <source-module>/<package>=<target-module>(,<target-module>)*
for your use case as :
--add-exports java.base/jdk.internal.misc=your.module
Note:- Disclaimer from JEP-261:Module System -
The `--add-exports` and `--add-opens` options must be used with great care. You can use them to gain access to an internal API of a library module, or even of the JDK itself, but you do so at your own risk: If that internal API is changed or removed then your library or application will fail.
Problem
It seems like the `SharedSecrets` and `JavaLangAccess` classes from the `sun.misc` package were removed in Java 9. Are there any replacements in Java 9 for the functionality provided by these classes?