This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ach! do applets and filestreams not mix?

 
Contra Kirby
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been looking up on the internet for quite a while how to make a FileWriter object in an applet. I always do exactly as the code says and get a permissions exception. I don't really know what to do about all of this...I am working on a UNIX filesystem, and I have even tried setting the permissions for the directory my applet is in to 777. The following is the code I used:

Ach! What have I done wrong lassie, what have I done wrong.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Welcome to JavaRanch!
Applets are meant to be downloaded across the Internet and run on a client. They're by default run in a "sandbox" in which they're not given access to local resource like files -- think of all the naughty things they could do otherwise!
Before an applet can open a file, it has to have a digital signature, and it has to ask permission. This can be thorny business. See here for some information about this.
[ February 09, 2004: Message edited by: Ernest Friedman-Hill ]
 
Tony Xavier
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Last year i wrote an Library applet. I had a whole library system where the admin could manage users, users could login, borrow, return books/cd's etc also change their pass.
Every user had a sepparate file where their info was stored such as password, books borrowed, date of borrow and returned, overdues, etc... .
Every time a user was created by the admin in the applet, a new file would be created with the user's name and password FROM an applet.
I used Windows and i had no problems writing such a code. Is what your trying to do resemble what i did? To create files from applets?
if so i can help u out, no prob.
D.X
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
D -
Welcome to JavaRanch!
We don't have too many rules here, but we do have our naming policy which requires that your display name be spelled out -- the last name can't be an initial. Please here over here to update yours, pronto. Thanks -- hope to see you around the Ranch!
 
Contra Kirby
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I want is for the applet to make a file on the server, not on the client...
 
Billybob Marshall
Ranch Hand
Posts: 202
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Contra Kirby:
What I want is for the applet to make a file on the server, not on the client...

Then you'd have to use a remote protocol, such as FTP (more common) or at least HTTP (a request to a servlet) to provide the server with the relevant details (where to put the file, what to name it, and its contents). You can't just use the normal stream I/O remotely (unless you have something like a remote mounted disk).
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Conrad- Welcome back. Looks like maybe you misplaced your old account - here it is. "Contra" isn't quite what we had in mind for "real name".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic