Rahul Prajapati
Rahul Prajapati

Reputation: 35

FileNotFoundException even if file is exist and path is properly supplied

I have a RCP Project wherein I am setting image to view and It was working fine but once I changed the folder name from 'icons' to 'logIcons' from eclipse , tool throws exception 'FileNotFoundException'. Previously path was 'icons\error.png' and after changing folder name I changed to 'logIcons\error.png' too but image doesn't load when workbench loads. Many time I have done this kind of folder changes and many time it throws exception but don't how to resolve it.

Upvotes: 0

Views: 88

Answers (1)

greg-449
greg-449

Reputation: 111142

You must list all the folders that you want included in a plugin in the build.properties file. You have probably forgotten to do this for logIcons. Open the build.properties editor and check the folders you need.

This is easy to forget as the code will work OK when you test run it from within Eclipse but will fail when you build the RCP.

You must also use the correct methods of accessing resources in a plugin. The FileLocator class is the appropriate class to use.

In testing you should always have -clean and -clearPersistedState specified in the Run Configuration to make sure that cached data is rebuilt to be current on each run.

Upvotes: 1

Related Questions