出于某种原因,我收到一条错误消息,说它无法找到或加载我的主类,谁能给我一个理由?
package FindFile;
import java.io.File;
/**
*
* @author Kevin
*/
public class FindFile
{
public void listFilesAndFolders(String directoryName)
{
File directory = new File(directoryName);
File[] fList = directory.listFiles();
for (File file : fList)
{
System.out.println(file.getName());
}
}
public void listFiles(String directoryName)
{
File directory = new File(directoryName);
File[] fList = directory.listFiles();
for (File file : fList)
{
if (file.isFile())
{
System.out.println(file.getName());
}
}
}
public void listFolders(String directoryName)
{
File directory = new File(directoryName);
File[] fList = directory.listFiles();
for(File file : fList)
{
if (file.isDirectory())
{
System.out.println(file.getName());
}
}
}
public void listFilesAndFilesSubDirectories(String directoryName)
{
File directory = new File(directoryName);
File[] fList = directory.listFiles();
for (File file : fList)
{
if (file.isFile())
{
System.out.println(file.getAbsolutePath());
} else if (file.isDirectory())
{
listFilesAndFilesSubDirectories(file.getAbsolutePath());
}
}
}
public static void main(String[] args)
{
FindFile findFile = new FindFile();
final String directoryWindows = "C:\\test";
findFile.listFiles(directoryWindows);
}
}