Access Permission

K

Ken Kast

I've written a small applet that reads and parses various XML files on the
server and creates Documents that are to be manipulated by javascript on the
client. It uses standard javax.xml.* packages out of 1.4.2_04. The applet
and XML files are in a subfolder of the directory where the web page is.
The applet works OK in an applet viewer in the IDE, but when I try to run it
in the browser I get the following error message in the console:

Exception while creating stream: access denied (java.io.FilePermission
C:\Documents and Settings\Ken\My Documents\My
Webs\kenkast\NewsReader\applets\default.opml read)

Here's the code that causes the exception:
public Document XDoc(URL url) {
Document doc = null;
Utilities.msg("XDoc URL: " + url);
try {
Utilities.msg("Try to get a stream");
InputStream in = url.openStream(); // Error occurs here
Utilities.msg("Got a stream");
BufferedInputStream bis = new BufferedInputStream(in);

Here are the two messages before the exception:
XDoc URL:
file:/C:/Documents%20and%20Settings/Ken/My%20Documents/My20Webs/kenkast/NewsReader/applets/default.opml
Try to get a stream

(NewsReader is where the html is.)

Can someone tell me why this doesn't work?

Thanks.
 
A

Andrew Thompson

I am confused. I thought browser security policy let an unsigned
applet access its directory and any subdirectories on the server.

Yes. You are confused. ;-)

Do you think that you running the policytool
on your IE could change what an applet coming
from my site would allow you to do on my server?

I went hunting at Sun for PolicyTool and found this first hit..
<http://java.sun.com/developer/onlineTraining/Security/Fundamentals/magercises/Policytool/>
Note the use of the word 'local' in first sentence..

[ Search facilities are wonderful things, no? ;-) ]
 

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
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top