I want to understand working of System.getProperty("user.dir")
in different applications like console application , web application etc.
It's giving different path while running from console application and web application. Here are the examples-:
While running in console application it prints as below:
D:\eclipse workspace mars\ResearchProject
Which is root directory of project in which java class files lies having System.getProperty("user.dir")
line of code.
On the other hand if I run System.getProperty("user.dir")
code from some servlet/ service/ business/ dac java class then it prints as below:
D:\eclipse-jee-mars-2-win32\eclipse
Which is root folder of eclipse.
How System.getProperty("user.dir")
works for different kind of application?
Is there any way to get root directory of web application?