title: Can't get JavaFX to run in Eclipse
body: <p>I have a Problem with JavaFX that I can't resolve after more than a day of researching on Google and different forums. I am currently learning Java with a tutorial and a few books, which has been going very nicely up until now.</p>
  
  <p>My problem is that I can't get JavaFX to run in eclipse. I have installed the e(fx)clipse addon.</p>
  
  <p>I have made sure that the JavaFX SDK is listed in the Libraries in the Java Buid Path and I tried opening a new JavaFX Project, but whatever I do I always get "the import javafx can't be resolved".</p>
  
  <p>I have tried all of this with the Java JDK 12 on Ubuntu 18.04 (my main system) and Win 8.1.</p>
  
  <p>Has anybody here an idea what could be wrong?</p>
  
  <p>Edit:</p>
  
  <p>This is the import statement:</p>
  
  <pre><code>import javafx.application.Application;
  </code></pre>
  
  <p>This is the Code of my Class (although i also tried the auto generated "Main" Class from the Eclipse JavaFX Project):</p>
  
  <pre><code>
  import javafx.application.Application;
  import javafx.stage.Stage;
  
  public class JvaFXDemo extends Application{
  
      public static void main(String[] args) {
          launch(args);
      }
  
      @Override
      public void start(Stage primaryStage) throws Exception{
          primaryStage.show();
      }
  }
  </code></pre>
  
  <p>Now i was able to get rid of this Error by creating a Class named "module-info.java" in the "scr" Folder that contains this Code:</p>
  
  <pre><code>requires javafx.base;
  requires javafx.controls;
  requires javafx.fxml;
  requires javafx.graphics;
  requires javafx.media;
  requires javafx.swing;
  requires javafx.swt;
  requires javafx.web;
  </code></pre>
  
  <p>Eclipse doesn't show any Errors in the Code now, but when i try to compile it i get a massive Exception:</p>
  
  <pre><code>Exception in Application constructor
  Exception in thread "main" java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:567)
      at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
  Caused by: java.lang.RuntimeException: Unable to construct Application instance: class application.Main
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:890)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
      at java.base/java.lang.Thread.run(Thread.java:835)
  Caused by: java.lang.IllegalAccessException: class com.sun.javafx.application.LauncherImpl (in module javafx.graphics) cannot access class application.Main (in module BlaBla) because module BlaBla does not export application to module javafx.graphics
      at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:376)
      at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:639)
      at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:490)
      at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$8(LauncherImpl.java:802)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
      at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
      at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
      at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
      at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
      ... 1 more
  </code></pre>