import java.io.*;
public class Rename {
public static void main(
String [] args) {
File f = new File("hola.jpg");
File f2 = new File ("bye.jpg");
f.renameTo(f2);
}
}
Has worked for me. The only thing I think can give you some trouble is you are working with the file, that it is open and so you can't change the name.