make sure you aren't running with a security manager installed. Diasable it if you do, or grant access to the required directory in the security policy file being used.
Main Topics
Browse All TopicsWhile creating a file getting access denied message. Any clue how to change the permission so ..everybody can create and update file contents. On the remote machine folder permissions look okay.
Here is the code i am using
public String testService(String str){
File file = new File("c:\\user_uploads\\an
try {
file.createNewFile();
return "created";
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println("An exception Occured in testService");
return e.getMessage();
}
}
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
If i do write below code its creating and writing
BufferedWriter outfile = new BufferedWriter(new FileWriter(file));
outfile.write("a xml string");
outfile.close();
System.out.println("File Writing");
return "created";
but i write file.createNewFile() //Access denied message.
Let me know if there is anyother way to create.
Permissions are checked on folder options they are okay and the security manger too
The above mentioned code works only for local machine but not remote machine. You may be copying your application into remote server and running from there.
Below options I got into my mind.
Option 1:
If you programe is in Windows,
1) Create a Virtual Network Drive and map it with remote folder and make sure that you have permissions for that folder.
2) Use the Virtual Drive path to create yoru file remotely
Option 2:
Create file in local machine and Use FTP/SCP or SSH java APIS to copy files into remote machines.
Note: In any case you need permissions of remote server
Business Accounts
Answer for Membership
by: CEHJPosted on 2009-05-20 at 15:08:52ID: 24436770
>>File file = new File("c:\\user_uploads\\an onymous\\t est.txt");
I don't understand - that would create a file on the *local* machine...