You can try this from JavaAction
You could create a constant, like Chris said, but also with a java-action that retrieves the path from your application configuration. This way you don't need to configure the same directory twice, one in your application settings and one in your constant. See the apidocs for more information about retrieving configuration in mendix.
I would use a constant for that and set in the server environment (m2ee.yaml)