java.io.FileNotFoundException(是一个目录)

时间:2022-06-14 22:39:37

This is a piece of code, I am trying to read a project. I am sure the project exists in the following path but I don't know why I am getting the following exception:

这是一段代码,我正在尝试阅读一个项目。我确信该项目存在于以下路径中,但我不知道为什么会出现以下异常:

org.eclipse.core.internal.resources.ResourceException()[567]: 
       java.io.FileNotFoundException "/home/XX" (Is a directory)

Code:

 IProject project;

 String projectLocation = "/home/XX";

 IProjectDescription description;

 description = project.getWorkspace().loadProjectDescription(new Path(projectLocation));

 project.create(description, new NullProgressMonitor());

 project.open(new NullProgressMonitor());

 project.refreshLocal(IResource.DEPTH_INFINITE,new NullProgressMonitor());

1 个解决方案

#1


2  

If /home/XX is the directory containing the project, the actual project file is /home/XX/.project, and that is the path you should be using.

如果/ home / XX是包含项目的目录,则实际项目文件是/home/XX/.project,这是您应该使用的路径。

According to the Eclipse documentation, loadProjectDescription requires the path in the local file system of an existing project description file", not the folder containing it.

根据Eclipse文档,loadProjectDescription需要现有项目描述文件的本地文件系统中的路径“,而不是包含它的文件夹。

#1


2  

If /home/XX is the directory containing the project, the actual project file is /home/XX/.project, and that is the path you should be using.

如果/ home / XX是包含项目的目录,则实际项目文件是/home/XX/.project,这是您应该使用的路径。

According to the Eclipse documentation, loadProjectDescription requires the path in the local file system of an existing project description file", not the folder containing it.

根据Eclipse文档,loadProjectDescription需要现有项目描述文件的本地文件系统中的路径“,而不是包含它的文件夹。