title: Jump one folder up in a URL in Java
body: <p>I have a URL that I get as below:</p>
  
  <pre><code>String jarFilePath = getClass().getProtectionDomain().getCodeSource().getLocation()
  </code></pre>
  
  <p>This would get me the complete path to the jar file. Now how do I jump one folder up and append some other path to it? For example., if the jarFilePath is something like:</p>
  
  <pre><code>c:/path/to/jar/file.jar
  </code></pre>
  
  <p>I want to jump one folder up and append another relative path like below:</p>
  
  <pre><code>c:/path/to/resources/path/to/resources/
  </code></pre>
  
  <p>Where the folders resources and jar are at the same directory level in the file system. </p>