You're right, jdk.internal.ref.Cleaner implements Runnable unlike sun.misc.Cleaner: http://hg.openjdk.java.net/panama/panama/jdk/file/089eb964a07a/src/java.base/share/classes/jdk/internal/ref/Cleaner.java
It works, I no longer need "--add-exports". Thank you very much. Le Samedi 6 août 2016 17h19, Julien Gouesse <goues...@yahoo.fr> a écrit : It doesn't work: [gouessej@localhost test-classes]$ ~/Téléchargements/jdk-9/bin/java -cp ../classes:../test-classes --add-exports java.base/jdk.internal.ref=ALL-UNNAMED engine/misc/TestDeallocationHelper Unrecognized option: --add-exports Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Ok I'm going to try to treat it as a Runnable. Le Samedi 6 août 2016 16h02, Alan Bateman <alan.bate...@oracle.com> a écrit : On 06/08/2016 02:52, Julien Gouesse wrote: > Hi > > > I need to run the cleaner of a direct NIO byte buffer by using the reflection > API to access to non public APIs as I successfully did with previous versions > of Java. The cleaner is in the class "Cleaner" in the package > "jdk.internal.ref" in the module "java.base" and my own module is unnamed. > Then, I tried to pass "--add-exports java.base/jdk.internal.ref=ALL-UNNAMED" > to the command "java" but I get the following exception: > [gouessej@localhost test-classes]$ ~/Téléchargements/jdk-9/bin/java -cp > ../classes:../test-classes engine/misc/TestDeallocationHelper --add-exports > java.base/jdk.internal.ref=ALL-UNNAMED You've put the --add-exports option after your main class on the command line, try place it before the main class so that it's considered as an argument to the java launcher rather an argument to your main class. One other thing to point out if that jdk.internal.ref.Cleaner is a Runnable so you can at least stay in the world of standard types. -Alan