我以前从未遇到过这个异常
org.eclipse.core.internal.resources.ResourceException: Resource '/External Plug-in Libraries' is not open.
at org.eclipse.core.internal.resources.Project.checkAccessible(Project.java:137)
at org.eclipse.core.internal.resources.Project.isNatureEnabled(Project.java:817)
at newmodulewizrd.ui.Integrate.printProjectInfo(Integrate.java:130)
at newmodulewizrd.ui.Integrate.getWorkSpace(Integrate.java:123)
at newmodulewizrd.ui.Integrate.presentOptionsAndAddToMain(Integrate.java:117)
at newmodulewizrd.ui.Integrate$2.actionPerformed(Integrate.java:84)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
这是我的代码
try {
if (project.isNatureEnabled("org.eclipse.jdt.core.javanature")) {
IJavaProject javaProject = JavaCore.create(project);
if(flag2==0) {
printPackageInfos(javaProject);
flag2=1;
} else {
IPackageFragmentRoot srcFolder = cm.createNewSourceFolder(project);
newModule = srcFolder.createPackageFragment(textfield.getText(), true,null);
printPackageInfos(javaProject);
try {
cm.refreshWorkspace();
} catch (CoreException e) {
e.printStackTrace();
}
}
} else {
System.out.println("something went wrong here");
}
} catch (CoreException e) {
e.printStackTrace();
}
我怀疑它正在尝试访问我的 java 项目中的“jre 系统库 [jre6] 文件夹 {below my src 文件夹}”
关于如何解决它的任何想法?