The*_*aME 1 java eclipse eclipse-plugin
我想rep.xml在eclipse插件中打印文件的绝对路径.
我已将文件rep.xml放在路径下
C:\Program Files\Eclipse\Documents\Eclipse\samplePlugin\resources\rep.xml.
我试着用它打印file.getLocation().
它回来了C:/Program Files/eclipse/Documents/runtime-EclipseApplication
如何在eclipse中打印绝对路径.请帮忙.
如果要读取插件中的文件,请使用以下命令:
Bundle bundle = Platform.getBundle("your plugin id");
URL url = FileLocator.find(bundle, new Path("path relative to the plugin"), null);
URL fileUrl = FileLocator.toFileURL(url);
File file = new File(fileUrl.getFile());
... read file using normal Java file APIs
您还可以使用FrameworkUtil获取捆绑包,避免必须硬编码插件ID:
Bundle bundle = FrameworkUtil.getBundle(getClass());
给你Bundle包含给定的类.
| 归档时间: | 
 | 
| 查看次数: | 1186 次 | 
| 最近记录: |