[英]Using Netbeans 8.0.2 and want to use org.apache.commons.io.FileUtils; how?
Specifically I want to use the FileUtils.contentEquals(file1, file2)
method. 具体来说,我想使用FileUtils.contentEquals(file1, file2)
方法。
I've downloaded and extracted files to C:\\Users\\Dov\\commons-io-2.4-bin\\commons-io-2.4
. 我已经将文件下载并解压缩到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;
我将那个路径名准确地添加到了Netbeans项目的Librairies
文件夹中,但是当然要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));
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.