簡體   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