Apache Commons IO is a java library with simple IO utilities and filters.
This requires the library commons-io-2.1.jar to be in classpath.
The following example shows using FileUtils.touch() API.
//Creates an empty file or updates the last updated timestamp on the
//same as the unix command of the same name.
FileUtils.touch(file);
System.out.println("Successfully touched the file");
}
}