我在Java中使用lucene来查找查询的排名文档,但我在getpath方法代码中发现了错误:
String DirectoryName = "Doc50" ;
File folder = new File(DirectoryName);
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) // loop to read files from doc50 folder...
{
if (listOfFiles[i].isFile()) // condition if current file is of filetype...
{
Path path = FileSystems.getDefault().getPath(DirectoryName, listOfFiles[i].getName());
String contents = new String(Files.readAllBytes(path), StandardCharsets.UTF_8); //read whole document in single string
addDoc(DocumentIndexer, contents, listOfFiles[i].getName()); //add document to indexed documents
}
错误我在线程“main”中遇到异常java.lang.Error:未解决的编译问题: FileSystem类型中的方法getPath(String,String [])不适用于参数(String,String)
请帮帮我。