Here you can find the source of renameFile(String oldPath, String newPath)
public static void renameFile(String oldPath, String newPath)
//package com.java2s; //License from project: Apache License import java.io.File; public class Main { public static void renameFile(String oldPath, String newPath) { try {/*from w w w . j av a2 s . c om*/ File dest = null; if (!oldPath.equals(newPath)) { File file = new File(oldPath); dest = new File(newPath); file.renameTo(dest); } } catch (Exception e) { } } }