aspose file tools*
The moose likes Applets and the fly likes Loading resources using classloader Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Loading resources using classloader" Watch "Loading resources using classloader" New topic
Author

Loading resources using classloader

Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Hello,
I have an applet and I need to load a picture to display in the applet. What I've tried is including the file containg the picture in the jar-file that holds my applet and other classes and then getting the picture using ClassLoader.getSystemResource(filename) and ClassLoader.getSystemResourceAsStream(filename) and that won't work.
Will I need to call the methods of the applets classloader instance instead of the static ones? If so how do I do that?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

This comes out of "Java Examples in a Nutshell" from O'Reilly & Associates (David Flanagan, author). It has been condensed slightly.


Customer surveys are for companies who didn't pay proper attention to begin with.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
Thanks, works great
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Loading resources using classloader
 
Similar Threads
Saving a picture of an applet
Reading text file with applet.
Image Icon not displaying properly
Uploading image and thumbnail
Unable to show icons in toolbar in the applet