• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

Applet writing to a file - SecurityException  RSS feed

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...
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
Boost this thread!