I'm trying to read in a local file in my web application on the server. When testing this outside of the deployment to JBoss, the file path is correct. However, when I deploy it to JBoss the file path changes JBoss's bin
directory. The user.dir
system property changes when it's deployed as a war.
How do I prevent that without using an absolute file path?
I want to avoid an absolute file path, because the project needs to be replicated on multiple machines that have different directory structures.
String curDir = System.getProperty("user.dir");
String fileLocation = curDir.toString() + "/end/of/path/to/flat.json";
JsonReader reader = new JsonReader(new InputStreamReader(new FileInputStream(fileLocation)));