File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Giving File Permission Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Giving File Permission" Watch "Giving File Permission" New topic
Author

Giving File Permission

Koh Khai Huat
Ranch Hand

Joined: Aug 05, 2005
Posts: 100
Hi guys,

I am creating a game applet and the game is done. When my game finish i need to write a string "WIN" to a text file. I got the filewriter done alr but when i was writing the string the program it gave me a error "File Access Denined" it says that the file access "write" permission is not granted.

I would like to ask if any of u guys know how to allow the file access "write" i am open to all suggestion and advice thanks in advance

regards
KKH


if (!WorkHard){
System.out.println("Fail!!!");
}
Vinayak patil
Ranch Hand

Joined: Aug 30, 2005
Posts: 67
Hi,

Have a look at the FilePermission Class (java.io.FilePermission)

This may help.

-Vinayak


"I can resist everything except temptation"
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

You are using a Unix system, right ?
You should make sure that the output directory is writtable for the user.
(using chmod may help)


[My Blog]
All roads lead to JavaRanch
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
If this is an applet, it is being executed on the client and not the server. So you would have to set up a network connection to write data to the server. If you want to save data on the client, you will have to sign the applet.
Koh Khai Huat
Ranch Hand

Joined: Aug 05, 2005
Posts: 100
hi,

i am running on Windows

regards
KKH
Vinayak patil
Ranch Hand

Joined: Aug 30, 2005
Posts: 67
hi,
i am running on Windows


Check the file properties and ensure that the "Read Only" checkbox is not checked.


-Vinayak
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

And read carefully what Keith Lynn said. You cannot write to the client machine from an applet without some permission (a real pain)
Koh Khai Huat
Ranch Hand

Joined: Aug 05, 2005
Posts: 100
hi guys,

i double check the file is not in "read only" and i indent to let my applet able to write on any pc that run's it. (it is a real pain!!!)

and until now i still dun know how to use file permission dose anyone of u know any examples that i can take a look thx its hard to understand man!!

regards
KKH
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Giving File Permission