File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes how to attach files to applet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "how to attach files to applet?" Watch "how to attach files to applet?" New topic

how to attach files to applet?

Bill Lee

Joined: Nov 25, 2006
Posts: 3

I created a java applet and it's using icons .PNG inside my java directory. I know applet can't access clients' files but my applet must load the icon pictures. So, I am having problem because my applet won't load in a webbrowser. Is there a way to "embed" my icons into my applet?
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Welcome to JavaRanch.

You could either keep the image files in the same web directory as the applet and access them through URL objects, or bundle them with the class files in a jar file and access them using getResourceAsStream.
I agree. Here's the link:
subject: how to attach files to applet?
It's not a secret anymore!