作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从 Eclipse 启动配置(“调试”>“调试配置”)加载文件。但是我不认为我的文件位于 Eclipse 运行时识别的正确位置。这是代码。
1 . Step 1 : Fetch the name of the program from the launch configuration
2 . Step 2 : Check if the file exits .
我每次都会中止。所以看来我的文件位置不正确。但我确信是的。
编辑
我使用以下 API String path ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(program)).getRawLocation().toString();
来确定该位置正在被搜查。然而,令人惊讶的是,以下 API 无法看到该成员存在于路径中
API 失败
String text = fProgramText.getText();
if (text.length() > 0) {
IPath path = new Path(text);
if (ResourcesPlugin.getWorkspace().getRoot().findMember(path) == null) {
setErrorMessage("Specified program does not exist");
return false;
}
} else {
setMessage("Specify a program");
}
最佳答案
发送
ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(program))
getRawLocation() 方法:
String path = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(program)).getRawLocation().toString();
这将为您提供文件的系统文件名(完全限定)...或者至少 Eclipse 认为您的文件应该在的位置。
如果该文件位于 Eclipse 正在查找的位置,但 Eclipse 没有看到它,您可能必须发送refreshLocal() 方法来将工作区与文件系统同步。当您在 Eclipse 外部编辑工作区字段时通常会出现这种情况。
关于java - Eclipse 启动配置失败 : What does ResourcesPlugin. getWorkspace().getRoot().getFile() 评估为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17181882/
我是一名优秀的程序员,十分优秀!