Reading from file in Eclipse plugin
eclipse, eclipse-plugin, java
Solution
Did you remember to include it in the build?
Secondly, using the classloader resource is probably better anyway
InputStream fileStream = myClass.getResourceAsStream( "/config.properties" );
Also, there is another way of opening a resource URL in eclipse using
url = new URL("platform:/plugin/com.example.plugin/config.properties");
InputStream inputStream = url.openConnection().getInputStream();
Problem
I need to read the configuration details from a properties file in eclipse. I have put the `config.properties` at the same level as `plugin.xml` and in the class file I call: ``` Properties properties = new Properties(); FileInputStream file; String path = "./config.properties"; file = new FileInputStream(path); properties.load(file); ``` I get a `file not found exception`. Is there a better way of doing this?