• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Eclipse JAR Problem

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Guys,

I got a problem with creating a Executable JAR in Eclipse.
My application uses images and when I try to run the JAR that Eclipse creates it doesn't find the image files.
I keep my images in a separate folder called images along with the src folder and others in the project.
It detects them fine when I run it in Eclipse.
The way I access the images in my Java code is like this:



I have also tried this way:



And neither way works.
I was hoping if anyone can help me, Thanks.
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getClass().getResource() is the correct way to access jarred resources.
However you need to supply the name of the resource.
How do you expect blank quotes to work?
reply
    Bookmark Topic Watch Topic
  • New Topic