title: Module not exporting exception in javafx 12
body: <p>I'm using Intellij with javafx 12, as a separate library. I managed to make it work. I made a game, and the graphics work great. Now I wanted to create a menu, with some buttons. It throws an exception when I try to add a button to the root of the scene, With the following exception:</p>
  
  <pre><code>Exception in thread "JavaFX Application Thread" java.lang.IllegalAccessError: superclass access check failed: class com.sun.javafx.scene.control.ControlHelper (in unnamed module @0x77b376ef) cannot access class com.sun.javafx.scene.layout.RegionHelper (in module javafx.graphics) because module javafx.graphics does not export com.sun.javafx.scene.layout to unnamed module @0x77b376ef
  </code></pre>
  
  <p>I googled it and found some solutions on stack overflow, which don't work for me. My command line arguments are the following (based on those solutions):</p>
  
  <pre><code>--module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" \
  --add-modules=javafx.swing,javafx.graphics,javafx.fxml,javafx.media,javafx.web,javafx.scene,javafx.controls \
  -p "C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.base.jar" : \
     "C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.graphics.jar"  \
  --add-exports javafx.graphics=ALL-UNNAMED \
  --add-exports javafx.controls/com.sun.javafx.charts=ALL-UNNAMED \
  --add-exports javafx.graphics/com.sun.javafx.iio=ALL-UNNAMED \
  --add-exports  javafx.graphics/com.sun.javafx.iio.common=ALL-UNNAMED \
  --add-exports  javafx.graphics/com.sun.javafx.css=ALL-UNNAMED \
  --add-exports  javafx.base/com.sun.javafx.runtime=ALL-UNNAMED \
  --add-exports javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED \
  --add-exports javafx.graphics/com.sun.javafx.scene.layout=ALL-UNNAMED
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>Edit 1: Minimal reproducible example</p>
  
  <ol>
  <li>download the latest intellij </li>
  <li>create a new javafx template project</li>
  <li>add javafx libraries</li>
  <li><p>add the following line to the command line arguments in run configurations</p>
  
  <p>--module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" \ --add-modules javafx.fxml,javafx.controls</p></li>
  </ol>
  
  <p>Note: Please check that the path to the libraries is right.</p>
  
  <ol start="5">
  <li><p>Change the start method to the following:</p>
  
  <p>@Override
  public void start(Stage primaryStage) throws Exception{
      Button button = new Button();
      primaryStage.setTitle("Hello World");
      primaryStage.setScene(new Scene(new Group(), 300, 275));
      primaryStage.show();
  }</p></li>
  </ol>
  
  <p>Important note: <strong>Please make sure that the button is from javafx, not awt library!</strong> This will work if you import button from awt by mistake.</p>
  
  <p>The button is never added to the root (nor the scene), and if you comment the line which creates the button, everything works!</p>
  
  <p>Edit 2:</p>
  
  <p>It looks like I'm running the configuration I have created, since the command line that intellij creates (when I click on ...) is the follwing:</p>
  
  <pre><code>"C:\Program Files\Java\jdk-12.0.2\bin\java.exe" --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1\lib\idea_rt.jar=50712:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2019.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Users\dusan\Documents\untitled\out\production\untitled;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.web.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.swing.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.media.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.graphics.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.fxml.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.controls.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.base.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx-swt.jar" -p "C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.base.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.graphics.jar" sample.Main --module-path "C:\Program Files\Java\javafx-sdk-11.0.2\lib" \ --add-modules javafx.fxml,javafx.controls
  </code></pre>