I want to add an AudioClip to my Game. I used Java and JavaFX and wrote my Code in Eclipse. The error that shows up is
java.lang.IllegalAccessError: class com.sun.media.jfxmediaimpl.NativeMediaManager (in unnamed module @0x5e355576) 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 @0x5e355576>
This is the code where i tried to initiliaze my AudioCLip
public AudioClip OWMusic = new AudioClip(getClass().getResource("/OWMusic.mp3").toExternalForm());
In your project, create a
resourcesfolder and add theOWMusic.mp3file inside. If this does not work, ensure the folder is added to your project's classpath. This last step depends more on your build system (ant/maven/gradle) and less the concise IDE you are using.See also How do I add a resources folder to my Java project in Eclipse