0

While I try to get path of current dir like bellow in my project it gives the location of where eclipse is downloaded.

String Cuurentdir= System.getProperty("user.dir");

I want path of my project dir.

Note- Using tomcat as a server.

Athakkar
  • 11
  • 5
  • 1
    Sounds like this might be an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem/66378#66378). If you want to read static data files, you probably want to place them inside your web application and use [Class.getResource](https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/lang/Class.html#getResource(java.lang.String)) to read them. – VGR Jul 28 '20 at 11:43

1 Answers1

0

String workingDir = (File)servletContext.getAttribute(ServletContext.TEMPDIR);

  • This gets you the (spec-required) "temporary directory" for the web application. It may have no relationship to the on-disk deployment of the web application, although it often does. – Christopher Schultz Jul 31 '20 at 19:17