Hi,
I asked this question on stackoverflow a while back and got no answer whatsoever. I have a directory called res included in my game which holds my sound and graphics data. I have a completed demo that I’m trying to build into a standalone jar artifact from IntelliJ IDEA. I included the directory in the artifact build, but when I run the standalone jar, it looks for the resources by prepending the entire root directory of my computer to the resource directory. Does anyone know how to fix this??
Here is some example output. Notice how it looks for the resource starting at root on my machine:
jeep@VICTORY ~/Dropbox/WGU/Capstone/C436/Demos $ java -jar Varg.jar
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/axe_throw.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/boss_explode.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/drink_potion.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/enemy_explode.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/enemy_hit.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/flame.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/grab_item.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/hero_dead.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/hero_hurt.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/squish.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/switch.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/textbox.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/void_sound.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/water_drain.wav (No such file or directory)
Error getting resource stream!
/home/jeep/Dropbox/WGU/Capstone/C436/Demos/res/audio/sfx/zap.wav (No such file or directory)
Exception in thread "main" java.lang.NullPointerException
at audio.Sfx.play(Sfx.java:36)
at Main.main(Main.java:15)
Shutting down TinySound...
TinySound shutdown complete!