title: Gradle OpenJFx11 : Error - JavaFx runtime components are missing
body: <p><strong>Context</strong>: Trying to create a simple JavaFx application using OpenJdK11 &amp; OpenJFx11</p>
  
  <p><strong>Issue</strong>: I get an error as below when I try to execute</p>
  
  <pre><code>Error: JavaFX runtime components are missing, and are required to run this application
  </code></pre>
  
  <p>I referred to <a href="https://stackoverflow.com/questions/52467561/intellij-cant-recognize-javafx-11-with-openjdk-11">Link1</a> &amp; <a href="https://stackoverflow.com/q/52131414/3127144">Link2</a> . I also referred to 'Getting started with JavaFx11' - <a href="https://openjfx.io/openjfx-docs/#gradle" rel="noreferrer">Link</a>
  As suggested in the getting started when I try specifying the run configuration I get a message as shown </p>
  
  <pre><code>run' in 'build' cannot be applied to '(groovy.lang.Closure)' less... (Ctrl+F1) 
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/VmxIn.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/VmxIn.jpg" alt="Image"></a></p>
  
  <p>Hope the issue faced is clear &amp; await inputs as to where I am going wrong. (using IntelliJ ide)</p>
  
  <p><strong>Code:</strong></p>
  
  <p><em>Main -</em> </p>
  
  <pre><code>public class Main extends Application {
  @Override
  public void start(Stage primaryStage) throws Exception {
      Parent root = FXMLLoader.load(getClass().getResource("/Sample.fxml"));
      StackPane stackPane = new StackPane(root);
      Scene scene = new Scene(stackPane);
      primaryStage.initStyle(StageStyle.TRANSPARENT);
      primaryStage.setScene(scene);
      primaryStage.show();
  
  }
  }
  </code></pre>
  
  <p><em>FXML-</em></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.layout.AnchorPane?&gt;
  &lt;AnchorPane xmlns="http://javafx.com/javafx"
              xmlns:fx="http://javafx.com/fxml"
              fx:controller="Controller"
              prefHeight="400.0" prefWidth="600.0"&gt;
  
  &lt;/AnchorPane&gt;
  </code></pre>
  
  <p><em>Gradle-</em></p>
  
  <pre><code>plugins {
  id 'java'
  }
  
  group 'testJavaFx'
  version '1.0-SNAPSHOT'
  
  sourceCompatibility = JavaVersion.VERSION_11
  
  repositories {
      mavenCentral()
  }
  
  dependencies {
      compile 'org.openjfx:javafx-base:11:win'
      compile 'org.openjfx:javafx-controls:11:win'
      compile 'org.openjfx:javafx-fxml:11:win'
      compile 'org.openjfx:javafx-graphics:11:win'
  
      testCompile group: 'junit', name: 'junit', version: '4.12'
  }
  
  compileJava {
      doFirst {
          options.compilerArgs = [
                  '--module-path', classpath.asPath,
                  '--add-modules', 'javafx.controls'
          ]
      }
  }
  
  run {
      doFirst {
          jvmArgs = [
                  '--module-path', classpath.asPath,
                  '--add-modules', 'javafx.controls'
          ]
      }
  }
  </code></pre>