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.

Page 1 of 2 12 LastLast
Results 1 to 25 of 28

Thread: .jar file won't execute

  1. #1
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:15 PM.


  2. #2
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: .jar file won't execute

    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.

  3. The Following User Says Thank You to Sean4u For This Useful Post:

    pajfilms (August 3rd, 2011)

  4. #3
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:15 PM.

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    Try printing out the values of soundFileName and the URL so you can verify that they have correct values.

  6. The Following User Says Thank You to Norm For This Useful Post:

    pajfilms (August 3rd, 2011)

  7. #5
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:15 PM.

  8. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    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.

  9. #7
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:15 PM.

  10. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    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.

  11. #9
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:17 PM.

  12. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    Does It work in the IDE? Now do it from the jar in a test folder.

  13. #11
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:15 PM.

  14. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    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.

  15. The Following User Says Thank You to Norm For This Useful Post:

    pajfilms (August 3rd, 2011)

  16. #13
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:15 PM.

  17. #14
    Super Moderator Sean4u's Avatar
    Join Date
    Jul 2011
    Location
    Tavistock, UK
    Posts
    637
    Thanks
    5
    Thanked 103 Times in 93 Posts

    Default Re: .jar file won't execute

    Just out of interest: I see backslashes in resource paths (because developer uses Windows?), does that work in Java?

  18. The Following User Says Thank You to Sean4u For This Useful Post:

    pajfilms (August 3rd, 2011)

  19. #15
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    What is the null that was printed out?

  20. #16
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:15 PM.

  21. #17
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    Try using /

  22. The Following User Says Thank You to Norm For This Useful Post:

    pajfilms (August 3rd, 2011)

  23. #18
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:16 PM.

  24. #19
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    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);

  25. The Following User Says Thank You to Norm For This Useful Post:

    pajfilms (August 3rd, 2011)

  26. #20
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:16 PM.

  27. #21
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    jar:file:/C:/Users/*****/Desktop/Test.jar!/sounds/break.wav
    soundFileName println(): sounds/break.wav
    That looks like it is looking in the jar file.

    java.lang.IllegalArgumentException: input == null!
    at javax.imageio.ImageIO.read(ImageIO.java:1362)
    at Fugel.load(Fugel.java:19)
    What is ImageIO.read trying to do? What are its arguments? on line 19

  28. The Following User Says Thank You to Norm For This Useful Post:

    pajfilms (August 3rd, 2011)

  29. #22
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:16 PM.

  30. #23
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    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

  31. The Following User Says Thank You to Norm For This Useful Post:

    pajfilms (August 3rd, 2011)

  32. #24
    Member
    Join Date
    Jun 2011
    Posts
    30
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Default Re: .jar file won't execute

    ..............
    Last edited by pajfilms; May 4th, 2012 at 01:16 PM.

  33. #25
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,133
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: .jar file won't execute

    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.
    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)
    Look at the source lines referred to and see what variable is null. Then find out why it is null.

  34. The Following User Says Thank You to Norm For This Useful Post:

    pajfilms (August 3rd, 2011)

Page 1 of 2 12 LastLast

Similar Threads

  1. What's wrong. Compile Ok but error when execute.
    By hantuapi in forum What's Wrong With My Code?
    Replies: 7
    Last Post: April 1st, 2011, 05:33 AM
  2. Could not execute the file
    By miaaa00 in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 20th, 2011, 08:28 AM
  3. Code doesn't execute properly
    By fride360 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: March 12th, 2011, 12:36 PM
  4. unable to execute prepared statement
    By nrao in forum What's Wrong With My Code?
    Replies: 1
    Last Post: November 11th, 2010, 08:26 PM
  5. How to execute a Java program independent of Netbeans.
    By ShaunB in forum Java Theory & Questions
    Replies: 4
    Last Post: January 19th, 2010, 06:23 AM