Kevin C. said:
I have an applet that reads jpg's. It works in AppletViewer but I get a
permission block for reading the file when I load it in my browser (all the
files in this case are local). How would I get permissions for it it to run
in a browser, and what would I need to do if I were to upload this to a
website?
Hi Kevin,
Short answer: Change your browser Java security settings to allow
access...
You may want to catch security exceptions in your applet, and when you
catch one, inform the user that they must change their security settings.
The method/tools used to change these settings vary with each web
browser (and for Applications, with each system).
File access priveleges for Java applets are usually kept "wide open" for
Applet Runner applications which can only run 'local' files (yeah, I
know, they don't have to be very local).
But web browsers usually have their own settings for file access,
network access, etc, because they are usually running untrusted applets
from unknown remote servers. Browsers usually allow access to ALL Java
files, but restrict files of other types by default. In MacIE5, these
settings are in Edit: Preferences...: Web Browser: Java: Security
Options. In WinIE they are way out in the middle of nowhere - I think
it was in Advanced: Blah: Blah: Java or Advanced: Blah: Blah:
Security... It's been a while...
On the Macintosh OS8/9 platform, some security settingd for applications
are controlled by a tool called JBindry. This is done on an application
by application basis, and requires creating a 'preferences file' for
each application. In return, the Java application becomes a first class
double clickable application, complete with icon, memory settings and
system preferences like all other applications. JBindry controls byte
code verification (on/off), Java proxy settings, and Java Firewall
settings.
Applet Security restrictions are lifted for Trusted Applets (with Java
security certificates), when the user approves the applet. Getting a
certificate for your applet will virtually allow you to ask the user to
lift the restrictions by simply clicking a dialog button. Highly
recomended...
You might want to read:
http://java.sun.com/sfaq/
Clearly, any method that can throw a SecurityException can potentially
fail to work properly if there is a security issue, so watch for that...
There is also a file called "java.security" somewhere on each system
which contains some security settings. The file is essentially human
readable, but not human editable (an error could prove fatal).
Hope this helps...
--Dave