Specifically I want to use the FileUtils.contentEquals(file1, file2)
method.
I've downloaded and extracted files to C:\\Users\\Dov\\commons-io-2.4-bin\\commons-io-2.4
.
I added exactly that pathname to my Netbeans project Librairies
folder but of course import org.apache.commons.io.FileUtils;
didn't compile.
What will make the program below compile?
import java.io.File;
import java.io.IOException;
import static org.apache.commons.io.FileUtils.contentEquals;
public class CompareFileContents {
public static void main(String[] args) throws IOException {
File file1 = new File("C:\\Users\\Dov\\Docs\\desktop.ini");
File file2 = new File("C:\\Users\\Dov\\Documents\\desktop.ini");
System.out.println("test1.txt and test2.txt are the same: " +
contentEquals(file1, file2));
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.