aspose file tools*
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
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: 10395
    
    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!]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Eclipse JAR Problem