Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / February 2006

Tip: Looking for answers? Try searching our database.

Loading image from jars from other jars etc

Thread view: 
JavaEnquirer - 22 Feb 2006 14:10 GMT
I have no problems loading an image from a jar using a class which
shares that jar. However, if I have a utility jar which contains a
ImageLoader utility class and use this class from my main application
jar which contains the images, I get a null pointer exception on
createImage.
( I'm using the utility class's class loader and calling the get
resource method. ) I don't get a problem running my application
jar-less in Eclipse.

When I got this error I assumed that by default you can only load a
resource from the same jar. So, I put the images into the utility jar
too, but to no avail - the same error.

Anyone got any pointers? Is there a way of loading resources from other
jars as I'm trying to do?

many thanks in advance.
JavaEnquirer - 22 Feb 2006 15:03 GMT
I've just tried passing the class loader of the application ( whose jar
contains the images ) to the ImageLoader class in the utility jar for
it to use. This doesn't seem to work either. Is there any mileage in
looking at the URLClassLoader class?
JavaEnquirer - 22 Feb 2006 15:42 GMT
I've come across a suggestion that I ensure that my application.jar is
included in the class path of my utility.jar. This way, the ImageLoader
in utility.jar can load images from application.jar as requested by
application.jar. I'd like to avoid this as utility jars shouldn't be
coupled to code that may call them.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.