Openjfx ea: error on trying to access private fields

fastegal at fastegal at
Tue Jul 24 11:44:00 UTC 2018

below is a small app that comes up with a button: on click it wants
to access a private field (obviouly via reflection) in the button class.
Due to relaxed permission constraints, that works in all java versions 9/10
without additional configuration and also with openjdk for non-fx classes.

With the combination of openjdk10 + openjfx-ea (both downloaded from their
respective download pages at it throws an error at runtime  
on clicking:

Exception in thread "JavaFX Application Thread"
Unable to make field private
javafx.scene.control.Button.defaultButton accessible:
module javafx.controls does not "opens javafx.scene.control" to  
unnamed module @b65246

Happens both from the command line (thanks Johan for the concise example,
easy to understand even for a command line hater like myself :) as  
from inside eclipse

Any idea what's wrong?

public class MinimalAccessFieldFX10Open extends Application {

     private Parent getContent() {
         Button button = new Button("something to click on");

         button.setOnAction(e -> {
             // okay
             Object def = invokeGetFieldValue(Button.class, button,  
   "getting the private field: " + def);
         BorderPane pane = new BorderPane(button);
         return pane;

     public void start(Stage primaryStage) throws Exception {
         primaryStage.setScene(new Scene(getContent(), 600, 400));;

     public static Object invokeGetFieldValue(Class<?> declaringClass,
             Object target, String name) {
         try {
             Field field = declaringClass.getDeclaredField(name);
             return field.get(target);
         } catch (NoSuchFieldException | SecurityException
                 | IllegalArgumentException | IllegalAccessException e) {
         return null;

     public static void main(String[] args) {

     private static final Logger LOG = Logger

More information about the openjfx-dev mailing list