aspose file tools*
The moose likes Applets and the fly likes Writing to a file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Writing to a file" Watch "Writing to a file" New topic
Author

Writing to a file

Barry Myer
Greenhorn

Joined: Oct 31, 2004
Posts: 7
I want my applet to write to a file. I'm not part of a network. I am getting the following error when I run it in applerviewer:

Error: access denied (java.io.FilePermission topScores.txt write)

How do I get permission to write? Give that this is my own PC that is not part of a network, wouldn't I automatically have permissions? Will I also need permission to read? If so, how do I get that?
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
You can find all the info you need on this topic at Sun Java Security FAQ. Good luck!


Give a man a fish, he'll eat for one day. Teach a man to fish, he'll drink all your beer.
Cheers, Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Srinivasa Kadiyala
Ranch Hand

Joined: Jun 10, 2004
Posts: 237
The exception u got is due to:

1.No one is allowed to write any stuff from internet to users machine.If u write by any other means with out user's accetance it is illeagal.
So the browser throws this exception.

To overcome this:

U have to get a Digital Certificate from a third party like VeriSign and attach the certificate to your .class file with Netscape's signtool command or SUN's jarsigner command.

Then all will work fine.

There are lots of exaples in the ent for this.I suggest u go to the SUN's site.They have even given an example for this.

You also try google with KW:"File reading and Writting from browser".

I hope this is useful.


Srini
Barry Myer
Greenhorn

Joined: Oct 31, 2004
Posts: 7
Thanks to you both.

I checked out the java site you suggested. It states that I should import a file called Duke into my identity database. Already, I am stumped. What is an identity database? and where is mine likely to be? I have jre 1.1.6 if that's helpful
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
Hi, Barry -

I found this security article on Sun's web site. Might be helpful. Good luck!
Barry Myer
Greenhorn

Joined: Oct 31, 2004
Posts: 7
Hi Jeff:

Both sources that you gave me ask me to type in things like:

% javakey -cs "duke" true

Where do I type it in? I do have a folder for jdk1.2.1/bin and it includes applications named jarsigner and keytool but you can't type anything in them.
Jeff Bosch
Ranch Hand

Joined: Jul 30, 2003
Posts: 804
They look to me like command-line entries. In Windows, start a DOS session and type them in. In Linux, well, that depends on the flavor, but the principle is the same...
Barry Myer
Greenhorn

Joined: Oct 31, 2004
Posts: 7
Thanks again but unfortunately I am still missing something. When I type that command, % javakey -cs Duke true all I get is the standard "Bad command or file name" I did download the plugin and the duke signature file and placed it in my User Home Directory (C:\Windows). Does anyone know what else I should do? I still don't know what a identity database is.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Writing to a file