Results 1 to 6 of 6
  1. #1
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default getResource() not working in Executable Jar

    Hy firends ... please have a look at my code ...it works fine when i run it in eclipse but when I make jar I doesn't work ..I wasted my whole day to fix it but failed .. thanks
    {
    Image im = ImageIO.read(IntroToGraphics_main.class.getResourc e("Resources/image.gif"));

    frame.setIconImage(im);
    }

  2. #2
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default getResource() not working in Executable Jar

    Hy firends ... please have a look at my code ...it works fine when i run it in eclipse but when I make jar I doesn't work ..I wasted my whole day to fix it but failed .. thanks
    {
    Image im = ImageIO.read(IntroToGraphics_main.class.getResourc e("Resources/image.gif"));

    frame.setIconImage(im);
    }

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: getResource() not working in Executable Jar

    Try debugging the code by printing what the getResouce() method returns. That will show you where the code is looking for the resource.
    Have you looked in the jar file (use a zip program) to see if the resource is where the code is looking for it and has the same spelling?
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: getResource() not working in Executable Jar

    I don't know ... what is this (zip programe) ???

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,308
    Rep Power
    25

    Default Re: getResource() not working in Executable Jar

    zip is a program that writes and reads zip files. jar files are the same as zip files and can be opened and its contents viewed by the zip program.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    allaudin's Avatar
    allaudin is offline Senior Member
    Join Date
    Apr 2013
    Posts
    271
    Rep Power
    0

    Default Re: getResource() not working in Executable Jar

    ok thanks I got it .... :)

Similar Threads

  1. getResource() not working in Executable Jar
    By allaudin in forum New To Java
    Replies: 1
    Last Post: 05-04-2013, 10:57 PM
  2. using getResource
    By joet1984 in forum New To Java
    Replies: 11
    Last Post: 02-26-2013, 09:43 AM
  3. getClass().getResource()
    By forwardbias in forum AWT / Swing
    Replies: 11
    Last Post: 03-29-2012, 03:10 AM
  4. create windows executable using executable jar file
    By sarwar1234 in forum New To Java
    Replies: 2
    Last Post: 02-07-2011, 08:29 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
  •