How to get plugin resource absolute path?

Hi all,

I’m developing a custom plugin which has a property file in it under src/main/resources/myPropertyFile.properties.
I would like to get the absolute path of this property file. This is only work for me locally.

When I upload the plugin jar to my jira test server, the path returned is just a relative path /myPropertyFile.properties and it can’t locate the file.
Could someone tell me how I can get the absolute path of a file which works both locally and on a test server?

Thanks!

I think normally, these type of files are accessed via the getResourceAsStream() from the class loader and are not supposed to be accessed from the filesystem. Using getResourceAsStream() will work both locally and when installed on the server.

If this doesn’t work for you, can you explain what you are trying to do?