簡體   English   中英

Eclipse插件-找不到文件異常

[英]Eclipse plugin - file not found exception

在我的插件項目中,我嘗試運行該插件時添加了一個名為“ database.properties”的新文件,但出現以下異常:

java.io.FileNotFoundException: database.properties (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)

這是我的項目結構:

在此處輸入圖片說明

我也將該文件包含在構建屬性中,此處顯示了屏幕截圖:

在此處輸入圖片說明

我嘗試清潔,重新啟動Eclipse,構建等。但是系統仍然找不到該文件。 誰能幫我? 我在這里想念什么?

您必須像這樣訪問文件:

Bundle bundle = Platform.getBundle("your_plugn_id");
InputStream is = bundle.getEntry("database.properties").openStream();

並將其包含在您的build.properties中:

bin.includes = META-INF/,\
           OSGI-INF/,\
           database.properties/,\
           .,\
           plugin.xml

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM