I'm trying to deploy a simple Maze Game Java application (not applet) as a JNLP as instructed by my professor. I've got the program working wonderfully on my system including the sound effects that we have to put in. However, when I run the JNLP file from the web (using a signed JAR), the Maze loads and works correctly, but the sounds clips won't play. The sound files are packaged in the JAR and are contained in the same directory as the class files. I won't post all the code b/c there are a dozen classes and several hundred lines of code, but here is how I implemented the sounds:
try{
Clip gong = AudioSystem.getClip();
AudioInputStream inputStream = AudioSystem.getAudioInputStream(Room.class.getResourceAsStream("homer.wav"));
gong.open(inputStream);
gong.start();
}catch(Exception e){}
and here is my JNLP
<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for MazeGame Application -->
<jnlp
spec="7.0+"
codebase="code-base-goes-here"
href="mazegame.jnlp">
<information>
<title>Maze Game</title>
<vendor>CS602</vendor>
<description>Maze Game Application</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.7+"/>
<jar href="MazeGame.jar"/>
</resources>
<application-desc main-class="maze.SimpleMazeGame"/>
</jnlp>
I found something with Google regarding a way to include the sound files as resources in the JNLP file and doing something differently in the program like getClass().getResource(), but the post was completely vague and I couldn't get it to work.
Does anyone here know why my sound files won't work when launching the application via JNLP? How do I fix? Thanks ahead of time.

New Topic/Question
Reply



MultiQuote




|