简体   繁体   中英

java.io.FileNotFoundException (Is a directory)

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());

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.

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM