title: Get relative path in Java EE project
body: <p>I've a normal Java class (neither a JSP nor a Servlet) that performs some processing on files like reading, writing, and executing some executable files. How to know the relative path of each file?</p>
  
  <p>I know about <code>getClass().getResourceStream()</code>, but this is useful only for reading files. And I know about <code>getServletContext().getRealPath()</code> but my code is in ordinary Java class not a servlet.</p>
  
  <p>I'd like to do the following</p>
  
  <pre><code>String relativePath = "path/to/exe";
  Runtime.getRuntime.exec(relativePath);
  </code></pre>