title: javaFX couldn't work on JDK 10.0.1
body: <p>I'm trying to run a javafx program on JDK10.0.1, but it caused the following problem.</p>
  
  <p>My development environment is win10 pro/intellij idea Community edition 2018.1.2/oracle jdk 10.0.1</p>
  
  <p>My code is </p>
  
  <pre><code>package LngToolAnalyzerFX.gui;
  
  import javafx.application.Application;
  import javafx.fxml.FXML;
  import javafx.fxml.FXMLLoader;
  import javafx.scene.Parent;
  import javafx.scene.Scene;
  import javafx.stage.Stage;
  import java.net.URL;
  
  public class Main extends Application {
  
  
      private MainUIController mainUICtr;
      @Override
      public void start(Stage primaryStage) throws Exception{
          String sceneFile = "UIconfig/MainUI.fxml";
          Parent root = null;
          URL    url  = null;
  
          url  = getClass().getClassLoader().getResource( sceneFile );
          FXMLLoader loader = new FXMLLoader(url);
          try
          {
              root = loader.load();
              System.out.println( "  fxmlResource = " + sceneFile );
              mainUICtr = loader.getController();
              mainUICtr.init();
          }
          catch ( Exception ex )
          {
              System.out.println( "Exception on FXMLLoader.load()" );
              System.out.println( "  * url: " + url );
              System.out.println( "  * " + ex );
              System.out.println( "    ----------------------------------------\n" );
              throw ex;
          }
  
          primaryStage.setTitle("LngToolAnalyzerFX");
          primaryStage.setScene(new Scene(root, 1024 , 768));
  
          primaryStage.show();
      }
  
  
      public static void main(String[] args) {
          launch(args);
      }
  }
  </code></pre>
  
  <p>and the controller class is </p>
  
  <pre><code>package LngToolAnalyzerFX.gui;
  import javafx.fxml.FXML;
  import javafx.scene.control.Button;
  import javafx.scene.control.CheckBox;
  import javafx.scene.control.TextArea;
  import org.languagetool.JLanguageTool;
  import org.languagetool.language.BritishEnglish;
  import org.languagetool.rules.*;
  import org.languagetool.tools.StringTools;
  
  import java.util.List;
  
  
  public class MainUIController {
      @FXML
      private Button checkBtn;
      private CheckBox onlineCheckBox;
      @FXML //fx:id="checkArea"
      private TextArea checkArea;
      @FXML//fx:id="resultArea"
      private TextArea resultArea;
  
      private String result;
  
      @FXML
      private void checkAction()
      {
          System.out.println("check");
          JLanguageTool lt = new JLanguageTool(new BritishEnglish());
          try
          {
              if(StringTools.isEmpty(checkArea.getText().trim()))
              {
                  System.out.println("Please enter the text");
              }
              else
              {
                  List&lt;RuleMatch&gt; matches = lt.check(checkArea.getText());
  
                  resultArea.setText("");
                  result = "";
                  for (RuleMatch match : matches) {
                      result += "Potential error at characters \n" +
                              match.getFromPos() + "-" + match.getToPos() +
                              ":" + match.getMessage() + "\n";
                      result += "Suggested correction(s): " +
                                  match.getSuggestedReplacements() + "\n\n";
                  }
                  resultArea.setText(result);
              }
  
          }
          catch(Exception ex)
          {
              System.out.println("----------------------");
              System.out.println(ex);
              System.out.println("----------------------");
          }
      }
  
  
      public void init()
      {
          //System.out.println("Hello");
          resultArea.setEditable(false);
          result = new String("");
      }
  
  }
  </code></pre>
  
  <p>finally I got the exception as following</p>
  
  <pre><code>Error:(4, 19) java: package javafx.fxml does not exist
  Error:(8, 20) java: package javafx.stage does not exist
  Error:(3, 26) java: package javafx.application does not exist
  Error:(7, 20) java: package javafx.scene does not exist
  Error:(5, 19) java: package javafx.fxml does not exist
  Error:(6, 20) java: package javafx.scene does not exist
  </code></pre>
  
  <p>Here is my pom code:</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;LngToolAnalyzer&lt;/groupId&gt;
      &lt;artifactId&gt;LngToolAnalyzerFX&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;languagetool.version&gt;4.1&lt;/languagetool.version&gt;
          &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
          &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
          &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
          &lt;maven.build.timestamp.format&gt;yyyy-MM-dd HH:mm&lt;/maven.build.timestamp.format&gt;
          &lt;maven.jar.plugin&gt;2.6&lt;/maven.jar.plugin&gt;  &lt;!-- NOTE: don't update without testing OpenOffice, 3.0.2 caused "Got no data stream!" after add-on installation --&gt;
          &lt;maven.assemby.plugin&gt;2.6&lt;/maven.assemby.plugin&gt;
          &lt;junit.version&gt;4.12&lt;/junit.version&gt;
          &lt;morfologik.version&gt;2.1.5&lt;/morfologik.version&gt;
          &lt;jackson.version&gt;2.9.4&lt;/jackson.version&gt;
          &lt;lucene.version&gt;5.5.4&lt;/lucene.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.languagetool&lt;/groupId&gt;
              &lt;artifactId&gt;languagetool-gui-commons&lt;/artifactId&gt;
              &lt;version&gt;${languagetool.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.languagetool&lt;/groupId&gt;
              &lt;artifactId&gt;languagetool-server&lt;/artifactId&gt;
              &lt;version&gt;${languagetool.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.languagetool&lt;/groupId&gt;
              &lt;artifactId&gt;languagetool-core&lt;/artifactId&gt;
              &lt;version&gt;${languagetool.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.languagetool&lt;/groupId&gt;
              &lt;artifactId&gt;language-all&lt;/artifactId&gt;
              &lt;version&gt;${languagetool.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.carrot2&lt;/groupId&gt;
              &lt;artifactId&gt;morfologik-tools&lt;/artifactId&gt;
              &lt;version&gt;${morfologik.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt;
              &lt;version&gt;1.7.25&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;
              &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;
              &lt;version&gt;1.2.3&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;!-- Some tests are used at runtime for rule developers, thus no 'test' scope here: --&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;${junit.version}&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;commons-io&lt;/groupId&gt;
              &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
              &lt;version&gt;2.5&lt;/version&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
              &lt;artifactId&gt;commons-collections4&lt;/artifactId&gt;
              &lt;version&gt;4.1&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>And the mainUI.fxml is here</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;?import javafx.scene.control.*?&gt;
  &lt;?import java.lang.*?&gt;
  &lt;?import javafx.scene.layout.*?&gt;
  &lt;?import javafx.geometry.Insets?&gt;
  &lt;?import javafx.scene.layout.GridPane?&gt;
  &lt;?import javafx.scene.control.Button?&gt;
  &lt;?import javafx.scene.control.Label?&gt;
  
  &lt;GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="LngToolAnalyzerFX.gui.MainUIController"&gt;
     &lt;columnConstraints&gt;
        &lt;ColumnConstraints /&gt;
     &lt;/columnConstraints&gt;
     &lt;rowConstraints&gt;
        &lt;RowConstraints /&gt;
     &lt;/rowConstraints&gt;
     &lt;children&gt;
        &lt;AnchorPane prefHeight="480.0" prefWidth="640.0"&gt;
           &lt;children&gt;
              &lt;Pane layoutX="28.0" layoutY="27.0" prefHeight="404.0" prefWidth="575.0"&gt;
                 &lt;children&gt;
                    &lt;SplitPane dividerPositions="0.5" orientation="VERTICAL" prefHeight="404.0" prefWidth="575.0"&gt;
                       &lt;items&gt;
                          &lt;ScrollPane prefHeight="200.0" prefWidth="200.0"&gt;
                             &lt;content&gt;
                                &lt;TextArea fx:id="checkArea" prefHeight="195.0" prefWidth="574.0" wrapText="true" /&gt;
                             &lt;/content&gt;
                          &lt;/ScrollPane&gt;
                          &lt;ScrollPane prefHeight="200.0" prefWidth="200.0"&gt;
                             &lt;content&gt;
                                &lt;TextArea fx:id="resultArea" prefHeight="195.0" prefWidth="574.0" wrapText="true" /&gt;
                             &lt;/content&gt;
                          &lt;/ScrollPane&gt;
                       &lt;/items&gt;
                    &lt;/SplitPane&gt;
                 &lt;/children&gt;
              &lt;/Pane&gt;
              &lt;Button fx:id="checKBtn" layoutX="28.0" layoutY="431.0" mnemonicParsing="false" onAction="#checkAction" text="check" /&gt;
              &lt;CheckBox layoutX="530.0" layoutY="435.0" mnemonicParsing="false" text="CheckBox" /&gt;
           &lt;/children&gt;
        &lt;/AnchorPane&gt;
     &lt;/children&gt;
  &lt;/GridPane&gt;
  </code></pre>
  
  <p>I've already set the project as jdk10.0.1 and project language level to "10" in project structure, hava I miss anything when I sat the environment ? However, the code works well in jdk1.8。</p>
  
  <p>Thanks anyone who check my question !</p>