Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

Applet writing to a file - SecurityException

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.
Screaming fools! It's nothing more than a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic