Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applet file i/o exceptions

Status
Not open for further replies.

Pinpoint

Programmer
Dec 23, 2001
49
GB
Hi,

I'm trying to write a simple applet to read from a local server .txt file and display different messages in a web-page depending on what is in the file. However I am getting the following errors:

java.security.AccessControlException: access denied (java.io.FilePermission Myfile.txt read)

at Java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)

What is the way round this file permission problem ?

Thanks,

Pinpoint


 
The applet probably trying to access a file on the local machine which of course it cannot do.

To access the server the applet must open a URL and read in the data from there.

Check out the classes in the java.net.* package

Good luck
 
Hi,

I have tried accessing the server file as a URL, but still get the error - now in the appletviewer, instead of when browsing the HTML as before. I'm not familiar with java.net classes (nor with Java to be honest!). Can I use FileInputStream, or do I need some other class ? If I do can you point me to some good documentation ?

Thanks,

Pinpoint
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top