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/
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 / 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?


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?