Urgent! While creating a file on remote machine . Access denied message. Remote machine is Windows

While 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\\anonymous\\test.txt");
            try {
                  return "created";
            } catch (Exception e) {
                  // TODO Auto-generated catch block
                  System.out.println("An exception Occured in testService");
                  return e.getMessage();
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>File file = new File("c:\\user_uploads\\anonymous\\test.txt");

I don't understand - that would create a file on the *local* machine...

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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.

cutie_smilyAuthor Commented:

This will create a file on my local machine. When i excute on the remote machine ..it doesn't access denied meessage.
How to chaneg the permissions
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

check the os that the user has required permissions
and as I mentioned above check for security manager

cutie_smilyAuthor Commented:
If i do write below code its creating and writing

BufferedWriter outfile = new BufferedWriter(new FileWriter(file));
                  outfile.write("a xml string");

                  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
you sure file is not a directory?

System.out.println("Directory "+file.isDirectory());
System.out.println("Exists "+file.exists());

If its linux box. then for that particular folder give as mentioned below

$chmod 777 tempfolder

This would give rights to that folder where your code would work
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.