I'm developing a Java SE 11 Maven project. In my project I have a folder called assets
(it's a sibling of the src
folder). This folder contains several folders and files. The whole folder has to be available at the application path - during development (in Netbeans) AND when it is deployed via an MSI package.
When running in the IDE, my assets live in <projectRoot>/assets
, while my current working dir is <projectRoot>
. And that's ok. I can access the assets folder via ./assets
from my current working directory.
But when I deploy my application, the current working directory might be something else, but not the application folder. So accessing the assets folder via ./assets
will fail.
What's the best approach in Java SE, to access a folder within the application's folder, independent of the current working directory?
Turning the assets
into a resource folder is not an option, because the files must editable by the user. The assets
folder has to reside directly in the file system.