• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet writing to a file - SecurityException

 
Mark McKee
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can't get an applet to write to a file (writeBytes.) It causes a security exception. Is OK when done in JBuilder environment, but once it is on the Web it can't write to the file. The class file and the file it has to write to are on the same server, so why does it do this and what do I have to do to get past the security problem?? Thanks...
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a deliberate limitation of Applets. Imagine how bad it would be if any web page you connected to might contain an applet which could write all over your local disk. I certainly wouldn't enable Java in my browser if that was the case.
If you are trying to write to a file on the server, you have to remember that although the applet class file originates from the server, it is actually loaded and executed by the machine running the browser.
Would you expect a program running on one machine to be able to write to a file on another?
If you really need this, you will have to write a simple program which runs on the server and accepts remote socket connections (like a web server) and adjust your applet to send its information to your new server software.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic