Guten Tag,
ich habe ein Problem mit dem Pfad den ich versuche zu erstellen. Ich habe mehrere Lösungen im Internet gefunden,
jedoch haben die mein Problem nicht gelöst.
Hier sieht man einmal was ich versuche. Ich habe mit System.out.printIn()versucht den Ort des Problems finden.
Auch bei anderen Sachen, zum Beispiel mit Bildern wird der Pfad nicht anerkannt. Die Datei ist im selben Ordner wie die Klasse welche das ausführen soll.
Ich habe es auch so versucht, aber das ändert nichts.
Ich kenne mich leider nicht gut genug mit Java bzw. in dem Fall mit Javafx aus, als das ich verstehe was das Problem ist. Ich hoffe ihr könnt mir weiterhelfen.
HIer ist noch einmal die Fehlermeldung die mir ausgegeben wird:
ich habe ein Problem mit dem Pfad den ich versuche zu erstellen. Ich habe mehrere Lösungen im Internet gefunden,
jedoch haben die mein Problem nicht gelöst.
Hier sieht man einmal was ich versuche. Ich habe mit System.out.printIn()versucht den Ort des Problems finden.
Auch bei anderen Sachen, zum Beispiel mit Bildern wird der Pfad nicht anerkannt. Die Datei ist im selben Ordner wie die Klasse welche das ausführen soll.
Java:
System.out.println("1");
Media backgroundMusic = new Media(getClass().getResource("Sonata.mp3").toExternalForm());
System.out.println("2");
MediaPlayer player = new MediaPlayer(backgroundMusic);
System.out.println("3");
player.setCycleCount(player.INDEFINITE);
System.out.println("4");
player.play();
Ich habe es auch so versucht, aber das ändert nichts.
Code:
Media backgroundMusic = new Media(getClass().getResource("file:///home/usr/Downloads/Sonata.mp3").toExternalForm());
Ich kenne mich leider nicht gut genug mit Java bzw. in dem Fall mit Javafx aus, als das ich verstehe was das Problem ist. Ich hoffe ihr könnt mir weiterhelfen.
HIer ist noch einmal die Fehlermeldung die mir ausgegeben wird:
Java:
1
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:566)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:465)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:364)
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:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:901)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:196)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalAccessError: class com.sun.media.jfxmediaimpl.NativeMediaManager (in unnamed module @0x7ef86927) 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 @0x7ef86927
at com.sun.media.jfxmediaimpl.NativeMediaManager.lambda$new$0(NativeMediaManager.java:138)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at com.sun.media.jfxmediaimpl.NativeMediaManager.<init>(NativeMediaManager.java:108)
at com.sun.media.jfxmediaimpl.NativeMediaManager$NativeMediaManagerInitializer.<clinit>(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.<init>(Locator.java:240)
at javafx.scene.media.Media.<init>(Media.java:393)
at Menu.Credits.CreditFrame.start(CreditFrame.java:40)
at javafx.graphics@18.0.1/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:847)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:484)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:457)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics@18.0.1/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:456)
at javafx.graphics@18.0.1/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics@18.0.1/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at javafx.graphics@18.0.1/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(GtkApplication.java:316)
... 1 more
Exception running application Menu.Credits.CreditFrame
/home/philipp/NetBeansProjects/Programmieren2/Prog2/nbproject/build-impl.xml:1341: The following error occurred while executing this line:
/home/philipp/NetBeansProjects/Programmieren2/Prog2/nbproject/build-impl.xml:936: Java returned: 1