There is only one constructor of the Media
-class: public Media(java.lang.String source)
see http://docs.oracle.com/javafx/2/api/javafx/scene/media/Media.html#Media%28java.lang.String%29
This constructor gets a URI as string. I have a JavaFX project and put a WAV file inside this project. When I deploy the project as a JAR, I can see (with 7-Zip for example), that the WAV file is also exported. There is no problem to get the content with
MyApplicationClass.class.getResourceAsStream("/resources/test.wav").
But what is the correct URI to refer this WAV file inside the deployed JAR for the Media
constructor? The URI
new Media("jar:.!/resources/test.wav")
doesnt work. The URI "jar:resources/test.wav"
fails too (becouse there is no reference to the JAR file).
Does anybody have an idea about the correct URI?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…