..............
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
..............
Last edited by pajfilms; May 4th, 2012 at 01:15 PM.
You could try showing us lines 12 and 24 from your SoundEffect class and showing a content listing of your jar file to demonstrate that the sound resource you're attempting to open is there. 'jar tf yourJarFile.jar' at the command line would do the trick.
pajfilms (August 3rd, 2011)
..............
Last edited by pajfilms; May 4th, 2012 at 01:15 PM.
Try printing out the values of soundFileName and the URL so you can verify that they have correct values.
pajfilms (August 3rd, 2011)
..............
Last edited by pajfilms; May 4th, 2012 at 01:15 PM.
What about printing out the URLs also. Do it both ways. In the IDE and standalone in the jar.
If it works in Eclipse, then its probably a path problem.
..............
Last edited by pajfilms; May 4th, 2012 at 01:15 PM.
Your URLs are all to disk files not to the contents of the jar file.
Where was the program executed that produced what you posted in post#7?
In the IDE or from the jar in a test folder.
..............
Last edited by pajfilms; May 4th, 2012 at 01:17 PM.
Does It work in the IDE? Now do it from the jar in a test folder.
..............
Last edited by pajfilms; May 4th, 2012 at 01:15 PM.
Run it from the command prompt and copy the contents of the screen here.
java -jar <YOURJARFILENAME>.jar
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'
Paste here.
pajfilms (August 3rd, 2011)
..............
Last edited by pajfilms; May 4th, 2012 at 01:15 PM.
Just out of interest: I see backslashes in resource paths (because developer uses Windows?), does that work in Java?
pajfilms (August 3rd, 2011)
What is the null that was printed out?
..............
Last edited by pajfilms; May 4th, 2012 at 01:15 PM.
Try using /
pajfilms (August 3rd, 2011)
..............
Last edited by pajfilms; May 4th, 2012 at 01:16 PM.
What println printed it? Add an id string to ALL the println so you know which one is printing
...println("This is me printing theVar=" + theVariableHere);
pajfilms (August 3rd, 2011)
..............
Last edited by pajfilms; May 4th, 2012 at 01:16 PM.
That looks like it is looking in the jar file.jar:file:/C:/Users/*****/Desktop/Test.jar!/sounds/break.wav
soundFileName println(): sounds/break.wav
What is ImageIO.read trying to do? What are its arguments? on line 19java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1362)
at Fugel.load(Fugel.java:19)
pajfilms (August 3rd, 2011)
..............
Last edited by pajfilms; May 4th, 2012 at 01:16 PM.
Change the code to use a URL object and print that out the same as for the sound files.The check that what is printed out is in the jar file with the correct path
pajfilms (August 3rd, 2011)
..............
Last edited by pajfilms; May 4th, 2012 at 01:16 PM.
Why does the error keep moving around? What happened to The error in post#21
Please identify which classes are yours in the error message.
Look at the source lines referred to and see what variable is null. Then find out why it is null.Exception in thread "main" java.lang.ExceptionInInitializerError
at Panel.load(Panel.java:37)
at Panel.<init>(Panel.java:31)
at Frame.<init>(Frame.java:23)
at Frame.main(Frame.java:33)
Caused by: java.lang.NullPointerException
at com.sun.media.sound.WaveFileReader.getAudioInputSt ream (WaveFileReader.java:180)
at javax.sound.sampled.AudioSystem.getAudioInputStrea m (AudioSystem.java:1128)
at SoundEffect.<init>(SoundEffect.java:26)
at SoundEffect.<clinit>(SoundEffect.java:12)
pajfilms (August 3rd, 2011)