title: How to find the directory of a file
body: <p>Like the title says, I need to find the directory/path of a file. I know that the computer running the program has the file but I don't know the path/directory. The only thing I know about the file is its name(file.jar).</p>
  
  <pre><code>File f = new File("file.jar");
      String ap = f.getAbsolutePath();
      return ap;
  </code></pre>
  
  <p>I have already tried using getAbsolutePath() method and it didn't work so I was wondering if there was another way to get the directory/path of file.jar.</p>