Results 1 to 3 of 3
  1. #1
    owboateng is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default Runnable jar does not include my resource files

    Hi everyone,
    I have exported my project in eclipse as runnable jar but the jar file does not include my resource file(pictures and sounds) so i have to put my jar in the folder containing the resource files before it runs.
    How to I export it to include my resource files?
    Thank you in advance for your help.

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,515
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by owboateng View Post
    Hi everyone,
    I have exported my project in eclipse as runnable jar but the jar file does not include my resource file(pictures and sounds) so i have to put my jar in the folder containing the resource files before it runs.
    How to I export it to include my resource files?
    Thank you in advance for your help.
    If you right-click your project and select Export ...>Jar file, you can select the directories you want to include in your .jar file; select the directories that contain your resource files.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  3. #3
    owboateng is offline Member
    Join Date
    Feb 2011
    Posts
    4
    Rep Power
    0

    Default

    I figured it out. I loaded the images using:
    ImageIcon icon = new ImageIcon(getClass().getResource("/pebble.png"));
    and then I copied the images to the bin folder of the project and it worked fine.
    Thanks guys anyway.

Similar Threads

  1. Including image files in runnable jar
    By bleah in forum Eclipse
    Replies: 5
    Last Post: 06-18-2011, 01:54 PM
  2. Replies: 0
    Last Post: 03-02-2010, 08:28 AM
  3. include-prelude/include-coda
    By devin in forum Java Servlet
    Replies: 0
    Last Post: 02-11-2009, 07:33 PM
  4. Replies: 5
    Last Post: 07-29-2008, 02:13 PM
  5. jsp:include and include file
    By Heather in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-14-2007, 04:19 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
  •