I try to use example from this question : How to copy a folder and all its subfolders and files into another folder
I made him static, and when I call copyDirectory(), I have an exception during program runs :
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Unhandled exception type IOException
At every line that uses this method.
I added
throws IOException
for every method that uses copyDirectory()
Error's count had been shorted, but they remained at native java classes. And I can't edit them : it would be an infinite editing recursion :))
Advance I'm sorry for bad english.
UPD: (Using ApacheCommonsIO)
import org.apache.commons.io.FileUtils;
// the rest import
public class MyClass{
public myMethod(){
String src = "/home/user/dir_src";
String dst = "/home/user/dir_dst";
FileUtils.copyDirectory(new File(src), new File(dst));
}
}