Where should I put my text file to access inside openfire plugins

Hello every body

I need to access a file inside a plugin. I don’t know where should I copy my file (I need to read a text file).

As openfire plugin folder structure says, resource go under classes folder. but it doesn’t work for me.

Any suggestion?


And also I need to include this file in my jar(obviously) to make it accessible when I deploy my plugin jar file in server.

I managed to solve this problem,

Since the files in classes directory of openfire are loaded as resources during plugin execution, you can get access to them by accessing Ressources from class loader.

this can be done by a code like this:

InputStream in = this.getClass().getClassLoader().getResourceAsStream(“your file name”);


InputStream in=XMPPServer.getInstance().getPluginManager().getPluginClassloader(ref to your plugin instance).getResourceAsStream(“your file name”);

both of them worked for me!

so you need to put the file in classes directory of openfire file structure.