I am using the following code but I am not able to rename the file.There is no such file newname.txt
in the system as well. I am using JRE6. Please help me out! Also I have tried to rename using Files class, That too isn't working.
File f1 = new File("oldname.txt");
File f2 = new File("newname.txt");
boolean b = f1.renameTo(f2);
The same code gets execute on SunOs UNIX but not on my windows 7. Why is it so ? Can I do something to execute it on my local machine?