0

I wrote a simple synth instrument gui that works well on my machine. However, as soon as I put it in a jar file, it no longer plays sounds when executing that jar file. I assume that has to do with the soundbank. Either way, I cannot get it to play a note on my machine when I run the jar file, so I presume it will not work on another person's machine. Any thoughts as to what might be going on? Thanks.

-Matt

Matt
  • 111
  • 1
  • 1
  • 4

2 Answers2

0

did you pack in .jar file even sounds that should play? How do you run your .jar file?

Something about resources in your .jar file (what could be your case) you can read here. About running .jar files and troubles with them you can read here and here.

Good luck and let us know if it helps you.

Community
  • 1
  • 1
kajo
  • 5,631
  • 4
  • 31
  • 29
  • Yes, I did pack the soundbank in the jar file. And then I ran the jar file both by double clicking it and through the command prompt (java -jar). And just to clarify, my program works fine. The manifest finds the main just fine and the GUI interface works just as it should. The only thing that doesn't happen is the playing of sound. – Matt Feb 12 '11 at 13:45
  • @Matt Did you try something like this? http://www.java2s.com/Code/Java/Development-Class/LoadimageandsoundfromJarfile.htm or http://www.java2s.com/Tutorial/Java/0120__Development/PlayanaudiofilefromaJARfile.htm ??? Because without seeing your code I can only guess where is problem :) – kajo Feb 12 '11 at 13:52
  • 1
    No, I didn't do something like that. That's probably where the issue is. I'll look into it some more. If it flops, I'll let you know. Thanks for all your help! – Matt Feb 12 '11 at 14:08
  • I have a direct call to open the soundbank.gm file at a specific location. Once more, I get no audio from the .jar file's execution. I'm not sure what's not getting linked, but there is an issue. Any other thoughts? – Matt Feb 12 '11 at 23:20
  • Are there any errors, exceptions? Again, it is hard to help if I can not see any your code snippet. And be sure that your volume on your dev computer is not muted :) – kajo Feb 13 '11 at 14:22
0

You are probably running your tests in an IDE using the java JDK but testing the app from the jar using the JRE.

See on how to fix it: http://www.jsresources.org/faq_midi.html#jre_soundbank

Manuel Darveau
  • 4,585
  • 5
  • 26
  • 36