title: Dynamic Web Project Get Project Path
body: <p>I have created a Maven Dynamic Web Project using Eclipse. I have created a webservice, the webservice calls a method from another class. Inside the class, i try to create a local folder in the folder of the project.</p>
  
  <p>So far i have tried:</p>
  
  <pre><code>String path = new java.io.File("").getAbsolutePath();
  
  String path = new File(".").getCanonicalPath();
  
  String path = System.getProperty("user.dir");
  
  String path = System.getProperty("catalina.base")
  </code></pre>
  
  <p>The first three returns the following path:</p>
  
  <pre><code>\eclipse\jee-mars\eclipse
  </code></pre>
  
  <p>The fourth statement returns the path:</p>
  
  <pre><code>\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp4
  </code></pre>
  
  <p>Simply, the path that i want is:</p>
  
  <pre><code>\workspace\MyProject
  </code></pre>