This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse JAR Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse JAR Problem" Watch "Eclipse JAR Problem" New topic
Author

Eclipse JAR Problem

Kevin Adu-Sarkodie
Greenhorn

Joined: Feb 28, 2011
Posts: 7
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.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10171
    
    8

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?


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse JAR Problem
 
Similar Threads
image display in swing application
getResource() from a static context
images in the client.jar?
swing application problem
Icons and Images question