Sign in to follow this  
Lucidquiet

[java] Another Newbie to applet question

Recommended Posts

What is the best way to retrieve a file associated with an applet (that is in the same or relative directory) from where the applet is served up from? Can and does an applet need to create a socket and then do an HttpGet to get the contents of a file? Or is this ability some how built into the Applet stuff? Sorry if this is stuff that is obvious in the applet package api doc. Some times if you ask a question you get an answer and some other useful stuff...sometimes. Thanks a lot, L-

Share this post


Link to post
Share on other sites
include it in the jar. Then you access the file just normal inside the jar. So let say you have package xxx and class A with a gif.

+ xxx
+ A.class
+ img.gif

class A
{
//...
//inside A
URL img = this.getClass().getRessource("./img.gif");

}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this