I have Java EE application and in one of its servlets I am using
System.getProperty("user.dir")
but this returns me my eclipse directory not the project directory !
for testing this I created a test project.. a stand alone Java application project in eclipse and used the same code and it returns the path of the project directory ! (this is what I want)
Question : why the behavior is diff ? how in my servlet can I get path of the project directory ?
For accessing the path of the project directory from a servlet, try this:
Other than that,
System.getProperty("user.dir")is in fact working as expected, returning the user working directory (which is not necessarily the same as the project’s directory). Please read the documentation first.