简体   繁体   中英

eclipse plugin load file

i have created a plugin which can load the image from the icons folder as follow:

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

It worked fine.

Similarly I have created a folder called "assets" inside eclipse plugin project, & created a file called "Temp.txt" inside it.

But I am unable to find a way to load it into my java class. Kindly help me out in getting through this.

Use:

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

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