Here you can find the source of renameFile(String oldFileName, String newFileName)
static public boolean renameFile(String oldFileName, String newFileName)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { static public boolean renameFile(String oldFileName, String newFileName) { boolean success = false; try {/*from w w w . ja v a 2 s . c o m*/ File fileToRename = new File(oldFileName); success = fileToRename.renameTo(new File(newFileName)); } catch (Exception e) { } return success; } }