繁体   English   中英

eclipse插件加载文件

[英]eclipse plugin load file

我创建了一个插件,可以从图标文件夹中加载图像,如下所示:

Image image = ImageDescriptor.createFromURL(
            FileLocator.find(bundle, new Path("icons/image.gif"), null))
            .createImage();

工作正常。

同样,我在eclipse插件项目中创建了一个名为“ assets”的文件夹,并在其中创建了一个名为“ Temp.txt”的文件。

但是我找不到将其加载到我的java类中的方法。 请帮助我解决这个问题。

采用:

URL url = FileLocator.find(bundle, new Path("assets/Temp.txt"), null);

URL fileUrl = FileLocator.toFileURL(url);

File file = new File(fileUrl.getPath());

... read the file in the usual way

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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