Security permissions question about Applets
Hello all.
I'm wanting to make an address book on my server, so I need to have it write to a file. I've read a bunch about it, and still can't figure it out.
I'm not exactly sure what the java home is supposed to be. I created a java.policy file in /usr/lib/j2sdk1.5-sun (I'm on Linux), but I think it might belong in /usr/lib/j2sdk1.5-sun/jre or /usr/lib/j2sdk1.5-sun/jre/lib/security
I'm also not exactly what the java.policy file is supposed to contain. Currently, it is:
grant codeBase"file:/home/scott/public_html/address_book/old/*"{
permission java.io.FilePermission"/home/scott/public_html/address_book/old/Test.txt","write";
};
Anyone want to help?
--
Scott Howard
[871 byte] By [
Scotteha] at [2007-10-2 23:24:12]

>I'm wanting to make an address book on my server, so I need to have it write to a file.
Well, applets run on the client - the browser which downloaded the class files - and therefore cannot access files on the server without some type of networking.
Caveat - the client and server are the same physical machine.
Solution - have your applet communicate back to the server it originates from. No policy twiddling is needed, as this is an automatic permission.
> What do you mean? I'm wanting it to write to a file on my server.
Applets do not run on the server, therefore they cannot directly write to files on the server.
>I want to be able to access it from a webpage from anywhere.
I understand that. I'm attempting to help you understand what you need to do.
As mentioned, if it accesses the file which resides on the same machine as the class file, you will be able to see it from anyplace the Applet can be seen from.If your Applet loads a .gif file, for example, that .gif file is in a folder near the Applet class file. Same idea here