title: how to make video player with javafx?
body: <p>Hello everyone im trying to make a simple video player with javafx and then add some controls later with scene builder however I cant even get the simple video to play , I keep getting an error saying</p>
  <pre><code>   Exception in Application start method
      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:564)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
      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:564)
      at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
  Caused by: java.lang.RuntimeException: Exception in Application start method
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
      at java.base/java.lang.Thread.run(Thread.java:832)
  Caused by: java.lang.IllegalAccessError: class com.sun.media.jfxmediaimpl.NativeMediaManager (in unnamed module @0x22fda225) cannot access class com.sun.glass.utils.NativeLibLoader (in module javafx.graphics) because module javafx.graphics does not export com.sun.glass.utils to unnamed module @0x22fda225
      at com.sun.media.jfxmediaimpl.NativeMediaManager.lambda$new$0(NativeMediaManager.java:110)
      at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
      at com.sun.media.jfxmediaimpl.NativeMediaManager.&lt;init&gt;(NativeMediaManager.java:107)
      at com.sun.media.jfxmediaimpl.NativeMediaManager$NativeMediaManagerInitializer.&lt;clinit&gt;(NativeMediaManager.java:78)
      at com.sun.media.jfxmediaimpl.NativeMediaManager.getDefaultInstance(NativeMediaManager.java:90)
      at com.sun.media.jfxmedia.MediaManager.canPlayProtocol(MediaManager.java:78)
      at com.sun.media.jfxmedia.locator.Locator.&lt;init&gt;(Locator.java:239)
      at javafx.scene.media.Media.&lt;init&gt;(Media.java:393)
      at javaapplication3.JavaApplication3.start(JavaApplication3.java:45)
      at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
      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:391)
      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
  Exception running application javaapplication3.JavaApplication3
  C:\Users\adamk\OneDrive\Documents\NetBeansProjects\JavaApplication3\nbproject\build-impl.xml:1341: The following error occurred while executing this line:
  C:\Users\adamk\OneDrive\Documents\NetBeansProjects\JavaApplication3\nbproject\build-impl.xml:936: Java returned: 1
  BUILD FAILED (total time: 1 second)
  </code></pre>
  <p>I made sure that the path is correct and everything but it still wont play. can someone please help ? thanks !!!</p>
  <pre><code>/*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package javaapplication3;
  
  /**
   *
   * @author adamk
   */
  /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  
  import java.io.File;
  import javafx.application.Application;
  import javafx.beans.binding.Bindings;
  import javafx.beans.property.DoubleProperty;
  import javafx.scene.Scene;
  import javafx.scene.layout.StackPane;
  import javafx.scene.media.Media;
  import javafx.scene.media.MediaPlayer;
  import javafx.scene.Group;  
  import javafx.scene.media.MediaView;
  import javafx.scene.paint.Color;
  import javafx.stage.Stage;
  
  import java.io.File;
  
   
  public class JavaApplication3 extends Application  
  {  
     public static void main(String[] args) {
      launch(args);
    }
      @Override  
      public void start(Stage primaryStage) throws Exception {  
          
      String path = &quot;C:\\1.mp4&quot;;  
            
          //Instantiating Media class  
          Media media = new Media(new File(path).toURI().toString());  
            
          //Instantiating MediaPlayer class   
          MediaPlayer mediaPlayer = new MediaPlayer(media);  
            
          //Instantiating MediaView class   
          MediaView mediaView = new MediaView(mediaPlayer);  
            
          //by setting this property to true, the Video will be played   
          mediaPlayer.setAutoPlay(true);  
            
          //setting group and scene   
          Group root = new Group();  
          root.getChildren().add(mediaView);  
          Scene scene = new Scene(root,500,400);  
          primaryStage.setScene(scene);  
          primaryStage.setTitle(&quot;Playing video&quot;);  
          primaryStage.show();  
    }
  }
  </code></pre>