Hallo everybody,
I'm a little bit new to
Java and I'a trying to sort out the problem I'am going to show you.
I have this piece of code:
File FileTasso = new File(txtFileNYinTasso.getText().toString());
File NewFileTasso = new File("d:\\paolib\\java\\prove\\rtlny\\beta.txt");
boolean success;
success = FileTasso.renameTo(NewFileTasso);
if (!success) {
jOptionPane1.showMessageDialog(this, "Rename error: " + FileTasso.toString());
}
I copied the instruction from some other code I have found in this forum.
The problem is that it does not work !
txtFileNYinTasso is a JTextField and contains d:\\paolib\\java\\prove\\rtlny\\alfa.txt
alfa.txt is a file end exists, beta.txt is the new one and does not exists.
I'am running it on a windows 2000 with Java version 1.4.1_01
The strange thing is that if run this piece of code it works !
File xFileTasso = new File("d:\\paolib\\java\\prove\\rtlny\\alfa.txt");
File xNewFileTasso = new File("d:\\paolib\\java\\prove\\rtlny\\beta.txt");
boolean success;
success = xFileTasso.renameTo(xNewFileTasso);
if (!success) {
jOptionPane1.showMessageDialog(this, "Errore rename:" + xFileTasso.toString());
}
Hope someone can help me to sort out this problem.
Thank you very much.
Paolo