Applets are downloaded so it is running on the client computer and for security reasons does not have access to the local file system. My recommendation, don's use an applet. If you have to (or for whatever reason want to) have the applet call a servlet on the application server and it can access the file system.
PS.
I am under a bit of a time constraint and I have quite a bit done with the applet, so maybe I could get some help with accessing the file. What needs to happen is when the user chooses a year and month from combo boxes a method needs to run to update the days available for that year and month. The user is trying to get a picture from that time that they picked so the file has a list of all the addresses for all of the pictures and the way I have it set up right now is that when the user chooses the year and month the updateDays method runs and looks through the addresses for a substring that has the year and month in it. The file naming system looks like this: .../Img-1983-01-01-00-GMS-2-IR.jpg so for example: if the user was to pick January 1983 the updateDay method would run through the entire list of addresses and put every address that had 1983-01 in it into an array and return that array to be put into the day combo box. This would work fine but like I said, I keep running into an AccessControlException and I don't know anything about servlets to help get around this.
If anything I said makes any sense could you please give me some advice?
Thank you
These files should belong on the server from which the applet is downloaded, just like where the HTML file referencing the applet, lives. Then the applet should retrieve the images not as files, but as resources obtainable thru normal URLs via the applet's getCodeBase() method.
This is about as much of a hint as I'm going to give.
URL resource = new URL(applet.getCodeBase(), "somefile.jpg"); // hint hint hint instead of new FileInputStream("somefile.jpg")
If I understand what you are saying then you are having the applet retrieve the images, but what I have is a list of addresses for the images. The images are on a server already, it is the list that is on my hard drive right now. And I had it set up to read the file that lists the addresses, not the image files themselves.
> If I understand what you are saying then you are
> having the applet retrieve the images, but what I
> have is a list of addresses for the images. The
> images are on a server already, it is the list that
> is on my hard drive right now. And I had it set up
> to read the file that lists the addresses, not the
> image files themselves.
Then put the list on the server too, and read it via the same kind of mechanism.
URL listUrl = new URL(applet.getCodeBase(), "theListFile");
InputStream stream = listURL.openStream();
// read it here just like you would a stream obtained from a FileInputStream
// ...
// close it too
stream.close();