Reputation: 18133
In my plugin project, I added a new file called "database.properties", when I try to run the plugin I am getting below exception:
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)
Here is my project structure:
Also I have included that file in build properties, screenshot is shown here:
I tried cleaning, restarting eclipse, building etc. But still system is unable to find the file. Can anyone help me? what I am missing here?
Upvotes: 1
Views: 967
Reputation: 932
You have to access the file like that:
Bundle bundle = Platform.getBundle("your_plugn_id");
InputStream is = bundle.getEntry("database.properties").openStream();
And includeit in your build.properties:
bin.includes = META-INF/,\
OSGI-INF/,\
database.properties/,\
.,\
plugin.xml
Upvotes: 2