Page 2 of 2 FirstFirst 12
Results 21 to 29 of 29
  1. #21
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: Runtime error when trying to display an ImageIcon.

    Quote Originally Posted by DarrylBurke View Post
    Doesn't it mean the current working directory?

    db
    Not for a File in the file system.
    It does for a resource, though.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  2. #22
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: Runtime error when trying to display an ImageIcon.

    Quote Originally Posted by Astralogic View Post
    And it out put "/C:/Users/Calvin/workspace/Sound/bin/Passage%20-%20Ludovico%20Einaudi.mp3" so I tried removing the first / from the file name in the program and the program output the same thing so I assume that /C:/ is OK. Problem is that's exactly where the file is that it's saying it can't find.
    OK, and it fails to open it?
    At that point (where you are printing the path) try:
    Java Code:
    File f = new File(skullURL);
    System.out.println(f.exists);
    If that returns true then there is something else wrong when you are reading the resource causing it to fail.
    In which case we need that code.
    Should that come back false then (as something of a longshot it has to be said) replace the spaces in the filename with underscores...though that should not really be the problem.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #23
    Astralogic is offline Member
    Join Date
    Mar 2012
    Posts
    71
    Rep Power
    0

    Default Re: Runtime error when trying to display an ImageIcon.

    Quote Originally Posted by Tolls View Post
    OK, and it fails to open it?
    At that point (where you are printing the path) try:
    Java Code:
    File f = new File(skullURL);
    System.out.println(f.exists);
    If that returns true then there is something else wrong when you are reading the resource causing it to fail.
    In which case we need that code.
    Should that come back false then (as something of a longshot it has to be said) replace the spaces in the filename with underscores...though that should not really be the problem.
    This is nuts. I put that code in both programs and they both return false. The sound program still gives a FNF error and the image program displays both files fine. I also tried replacing the spaces with underscored and it made no difference at all.

    Something is very bizarrely wrong.

  4. #24
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: Runtime error when trying to display an ImageIcon.

    So when you changed the space to underscore you did it for both the file itself and in the code?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #25
    Astralogic is offline Member
    Join Date
    Mar 2012
    Posts
    71
    Rep Power
    0

    Default Re: Runtime error when trying to display an ImageIcon.

    Quote Originally Posted by Tolls View Post
    So when you changed the space to underscore you did it for both the file itself and in the code?
    Yeah I changed them both, it must be some kind of bug.

  6. #26
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: Runtime error when trying to display an ImageIcon.

    Well yes, it will be, but in your code somewhere, not the Java libraries.
    It's probably something blindingly obvious, but forum-based debugging is not exactly easy.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  7. #27
    Astralogic is offline Member
    Join Date
    Mar 2012
    Posts
    71
    Rep Power
    0

    Default Re: Runtime error when trying to display an ImageIcon.

    Quote Originally Posted by Tolls View Post
    Well yes, it will be, but in your code somewhere, not the Java libraries.
    It's probably something blindingly obvious, but forum-based debugging is not exactly easy.
    If I compress the entire project folder and send it to you would that be useful in helping me solve this?

  8. #28
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,820
    Rep Power
    19

    Default Re: Runtime error when trying to display an ImageIcon.

    I do have a job you know.
    I doubt my client would be too impressed me debugging someone else's work on their time.

    All I can suggest is avoid mixing File-based stuff with resource-based stuff, since that could be part of the problem.
    If the code is using resources then stick to URLs and getResourceAsStream and avoid File and FileReader/Writer/IOStreams...just wrap the Stream in a BufferedWhatever.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  9. #29
    Astralogic is offline Member
    Join Date
    Mar 2012
    Posts
    71
    Rep Power
    0

    Default Re: Runtime error when trying to display an ImageIcon.

    Quote Originally Posted by Tolls View Post
    I do have a job you know.
    I doubt my client would be too impressed me debugging someone else's work on their time.

    All I can suggest is avoid mixing File-based stuff with resource-based stuff, since that could be part of the problem.
    If the code is using resources then stick to URLs and getResourceAsStream and avoid File and FileReader/Writer/IOStreams...just wrap the Stream in a BufferedWhatever.
    There's no need to make it seem like I demanded you drop everything including your job and do it right now. You could have just said 'no'.

    But thanks anyway for the help so far, I do appreciate it. I'll go ask on Yahoo Answers.

    Astralogic

Page 2 of 2 FirstFirst 12

Similar Threads

  1. display ImageIcon in JList when tab is changed.
    By gammaman in forum AWT / Swing
    Replies: 0
    Last Post: 05-25-2012, 03:15 PM
  2. Error in Javax.Swing.ImageIcon
    By raj.mscking@gmail.com in forum Advanced Java
    Replies: 7
    Last Post: 01-28-2012, 12:14 PM
  3. [SOLVED] JButton does not display ImageIcon properly
    By Singing Boyo in forum New To Java
    Replies: 1
    Last Post: 04-17-2009, 03:47 AM
  4. Replies: 3
    Last Post: 01-23-2009, 08:53 AM
  5. Replies: 1
    Last Post: 10-29-2008, 07:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •