title: How to get full base path of spring application running on CentOS Wildfly server?
body: <p>I need to get the <em>full path</em> of my deployed spring application using Java. I tried following to get the path</p>
  
  <pre><code>getClass().getProtectionDomain().getCodeSource().getLocation().getPath()
  </code></pre>
  
  <p>which returned following:</p>
  
  <ul>
  <li>On Wildfly running on CentOS : </li>
  </ul>
  
  <blockquote>
    <p>"/content/MyProject.war/WEB-INF/classes"</p>
  </blockquote>
  
  <p>(partial path)</p>
  
  <ul>
  <li>On Wildfly running on Win7 : </li>
  </ul>
  
  <blockquote>
    <p>"/C:/wildfly-8.2.0.Final/standalone/deployments/MyProject.war/WEB-INF/classes"</p>
  </blockquote>
  
  <p>(returning full path)</p>
  
  <p>Above worked on my <code>Windows</code> machine but not working on <code>Wildfly</code> running on <code>CentOS</code>.</p>