title: Netbeans 11 - Maven and JavaFX - javafx.application does not exist
body: <p>This is a new project, created clicking New project -> Java with Maven -> JavaFX Application</p>
  
  <p>As the project is crated, all lines of code related to javafx gerate an error "package javafx.application does not exist".</p>
  
  <p>During the creation of the project I have been asked to unstall the javafx plugin, so I did.</p>
  
  <p>Here is my MainApp.class</p>
  
  <pre><code>package com.mycompany.mavenproject1;
  
  import javafx.application.Application;
  import static javafx.application.Application.launch;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  
  
  public class MainApp extends Application {
  
      @Override
      public void start(Stage stage) throws Exception {
          Parent root = FXMLLoader.load(getClass().getResource("/fxml/Scene.fxml"));
  
          Scene scene = new Scene(root);
          scene.getStylesheets().add("/styles/Styles.css");
  
          stage.setTitle("JavaFX and Maven");
          stage.setScene(scene);
          stage.show();
      }
  
      /**
       * The main() method is ignored in correctly deployed JavaFX application.
       * main() serves only as fallback in case the application can not be
       * launched through deployment artifacts, e.g., in IDEs with limited FX
       * support. NetBeans ignores main().
       *
       * @param args the command line arguments
       */
      public static void main(String[] args) {
          launch(args);
      }
  
  }
  </code></pre>
  
  <p>Here is the pom file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;com.mycompany&lt;/groupId&gt;
      &lt;artifactId&gt;mavenproject1&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;jar&lt;/packaging&gt;
  
      &lt;name&gt;mavenproject1&lt;/name&gt;
  
      &lt;properties&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;mainClass&gt;com.mycompany.mavenproject1.MainApp&lt;/mainClass&gt;
      &lt;/properties&gt;
  
      &lt;organization&gt;
          &lt;!-- Used as the 'Vendor' for JNLP generation --&gt;
          &lt;name&gt;Your Organisation&lt;/name&gt;
      &lt;/organization&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.6&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;unpack-dependencies&lt;/id&gt;
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;unpack-dependencies&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;excludeScope&gt;system&lt;/excludeScope&gt;
                              &lt;excludeGroupIds&gt;junit,org.mockito,org.hamcrest&lt;/excludeGroupIds&gt;
                              &lt;outputDirectory&gt;${project.build.directory}/classes&lt;/outputDirectory&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
                  &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt;
                  &lt;version&gt;1.2.1&lt;/version&gt;
                  &lt;executions&gt;
                      &lt;execution&gt;
                          &lt;id&gt;unpack-dependencies&lt;/id&gt;
  
                          &lt;phase&gt;package&lt;/phase&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;exec&lt;/goal&gt;
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;executable&gt;${java.home}/../bin/javafxpackager&lt;/executable&gt;
                              &lt;arguments&gt;
                                  &lt;argument&gt;-createjar&lt;/argument&gt;
                                  &lt;argument&gt;-nocss2bin&lt;/argument&gt;
                                  &lt;argument&gt;-appclass&lt;/argument&gt;
                                  &lt;argument&gt;${mainClass}&lt;/argument&gt;
                                  &lt;argument&gt;-srcdir&lt;/argument&gt;
                                  &lt;argument&gt;${project.build.directory}/classes&lt;/argument&gt;
                                  &lt;argument&gt;-outdir&lt;/argument&gt;
                                  &lt;argument&gt;${project.build.directory}&lt;/argument&gt;
                                  &lt;argument&gt;-outfile&lt;/argument&gt;
                                  &lt;argument&gt;${project.build.finalName}.jar&lt;/argument&gt;
                              &lt;/arguments&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                      &lt;execution&gt;
                          &lt;id&gt;default-cli&lt;/id&gt;
                          &lt;goals&gt;
                              &lt;goal&gt;exec&lt;/goal&gt;                            
                          &lt;/goals&gt;
                          &lt;configuration&gt;
                              &lt;executable&gt;${java.home}/bin/java&lt;/executable&gt;
                              &lt;commandlineArgs&gt;${runfx.args}&lt;/commandlineArgs&gt;
                          &lt;/configuration&gt;
                      &lt;/execution&gt;
                  &lt;/executions&gt;  
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
                  &lt;version&gt;3.1&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;source&gt;1.7&lt;/source&gt;
                      &lt;target&gt;1.7&lt;/target&gt;
                      &lt;compilerArguments&gt;
                          &lt;bootclasspath&gt;${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar&lt;/bootclasspath&gt;
                      &lt;/compilerArguments&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
                  &lt;version&gt;2.16&lt;/version&gt;
                  &lt;configuration&gt;
                      &lt;additionalClasspathElements&gt;
                          &lt;additionalClasspathElement&gt;${java.home}/lib/jfxrt.jar&lt;/additionalClasspathElement&gt;
                      &lt;/additionalClasspathElements&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>