title: How to start JavaFX app on Java 8 Ubuntu today?
body: <p>Im trying to start application but got errors: </p>
  
  <pre><code>java.lang.ClassNotFoundException: com.sun.glass.ui.gtk.GtkPlatformFactory   at
    java.net.URLClassLoader.findClass(URLClassLoader.java:381)  at
    java.lang.ClassLoader.loadClass(ClassLoader.java:424)   at
    java.lang.ClassLoader.loadClass(ClassLoader.java:357)   at
    java.lang.Class.forName0(Native Method)   at
    java.lang.Class.forName(Class.java:264)   at
    com.sun.glass.ui.PlatformFactory.getPlatformFactory(PlatformFactory.java:42)
      at com.sun.glass.ui.Application.run(Application.java:146)   at
    com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
      at
    com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
      at
    com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
      at
    com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
      at
    com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)   at
    sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
    Exception in thread "main" java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)   at
    sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
    Caused by: java.lang.NullPointerException   at
    com.sun.glass.ui.Application.run(Application.java:146)  at
    com.sun.javafx.tk.quantum.QuantumToolkit.startup(QuantumToolkit.java:257)
      at
    com.sun.javafx.application.PlatformImpl.startup(PlatformImpl.java:211)
      at
    com.sun.javafx.application.LauncherImpl.startToolkit(LauncherImpl.java:675)
      at
    com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:337)
      at
    com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
      ... 5 more 
  </code></pre>
  
  <p>And a message <code>Failed to load Glass factory class</code> at the end of the stack trace.</p>
  
  <p>I also tried to add javafx as a maven dependency and to add this jar to classpath. And I use IDEA for my project.</p>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>My code is simple Hello JavaFX exmaple:</p>
  
  <pre><code>public class Application extends javafx.application.Application {
  
      public static void main(String[] args) {
          launch(args);
      }
  
      @Override
      public void start(Stage primaryStage) {
          Button btn = new Button();
          btn.setText("Say 'Hello World'");
          btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() {
  
              public void handle(ActionEvent event) {
                  System.out.println("Hello World!");
              }
          });
  
          StackPane root = new StackPane();
          root.getChildren().add(btn);
  
          Scene scene = new Scene(root, 300, 250);
  
          primaryStage.setTitle("Hello World!");
          primaryStage.setScene(scene);
          primaryStage.show();
      }
  }
  </code></pre>
  
  <p><strong>UPDATE 1:</strong> </p>
  
  <p>I used debug and found the excpetion throws inside ThreadPoolExecutor.java at line 1057. Also:</p>
  
  <p><a href="https://i.stack.imgur.com/4z5HI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4z5HI.png" alt="enter image description here"></a></p>
  
  <p>And yes! After executing this code fragment first exception appears in the project console.</p>