JApplet security issue

K

kurdt.johnston

Hi,

I am trying to find a work-around for a java applet.
I am trying to write to a log file using java.util.logging.

The problem is, I keep getting a file access violation.
From what I understand from reading various articles... it isn't an
easy task to write to files from an applet because of the security
restrictions.
One solution I came across earlier was to have the applet call an
application which will in-turn write to the file, but this is a it
messy.

Is it possible to use the policytool for an applet. If so, what
permissions should be granted to allow just enough permission to write
to the log file?

Does anybody have any suggestion as to what would be the best approach
for this?

Thank you in advance,
Kurdt
 
S

SPG

Hi,

I am trying to find a work-around for a java applet.
I am trying to write to a log file using java.util.logging.

The problem is, I keep getting a file access violation.
easy task to write to files from an applet because of the security
restrictions.
One solution I came across earlier was to have the applet call an
application which will in-turn write to the file, but this is a it
messy.

Is it possible to use the policytool for an applet. If so, what
permissions should be granted to allow just enough permission to write
to the log file?

Does anybody have any suggestion as to what would be the best approach
for this?

Thank you in advance,
Kurdt

Hi Kurdt,

Any activities from an applet that directly access the outside world require
permissions - Unless you are connecting back to the server from whence the
applet was downloaded.

The easiest way is to sign your applet, that way your clients can accept the
certificate when presented, hence give you permissions to write your file.
The local policy file is an option, but depending on th enumber of users
could be quite cumbersome.

here is a good reference:

http://java.sun.com/developer/technicalArticles/Security/Signed/

or here:

http://java.sun.com/developer/onlineTraining/Programming/BasicJava1/data.html#sec

One work around would be to call out to a javascript function in your HTML,
and get that to do the logging.. Bit nasty though.

HTH

Steve
 
K

kurdt.johnston

Hi Steve,

Thanks for the reply and also the two links.

Just as an update to this, I now have my applet signed and although I
still have a couple of problems with the file access, I think it's just
a matter of setting the right permissions, etc.

Anyway, thanks again,
Kurdt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top