I have a java project that consists of several modules:
myWebApp
- conf //not a java module, just text files
- ModuleA
-- src
-- target
-- moduleA.iml
-- pom.xml
- ModuleB
...
- pom.xml
- myWebApp.iml
- myWebApp.env
I want to access myWebApp.env
file (which is a java properties file) from a Class (which is obviously under a module's src folder), like:
InputStream is = new FileInputStream(<RelativePathToEnvFile>);
The problem is that relative paths seem to work only for subdirectories under modules' source root, or anywhere inside the classpath using the getResource() trick as mentioned here
On every other language I know I could do something like:
InputStream is = new FileInputStream("../../../../../myWebApp.env");
Isn't this possible in java?