I have an older java web application which run as root. I wanted to provide relative path to my code in this old application where I have a file I want to read.
To determine the current path where my code runs I did this.
System.out.println(System.getProperty("user.dir"));
Note : This is a regular web app where code resides in src/
My question is if I run the web app as root I always get '/'.
But on my eclipse if I run the same code I get path for my project root directory. Why is that the case ?
Also this will help me figure out how do I provide relative path when the application runs as root.
Kindly let me know. Thanks in advance.