Thursday, August 27, 2009

How do you read resources within a plugin ?

There are some txt, xml, image files in your plugin. You want to load them and read them within your application. How do you do that?

Dont fret... And dont go to the extent of using java.util.jar package.
Eclipse framework provides you a very clean mechanism to do the same

Use org.eclipse.core.runtime.FileLocator apis to load the required resources within your plugin. Code snippets are easily available.

What eclipse does internally in this case is: It unzips the specified resources in /configuration/. From within this location the resources are now read as regular files from file system.

No comments:

Post a Comment