title: Get current path of executed file
body: <p>I try to write and read to the file in my java project file called Books.txt.
  The problem is that I can access the file only if partialPath has full path to the file.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>public &lt;T&gt; List&lt;T&gt; readFromFile(String fileName) {
  
      private String partialPath = "\\HW3\\src\\java\\repos\\";
  
      try {
          String path = partialPath + fileName;
          FileInputStream fi = new FileInputStream(path);
          ObjectInputStream oi = new ObjectInputStream(fi);
          // Read objects
          List&lt;T&gt; items = (List&lt;T&gt;) oi.readObject();
          oi.close();
          fi.close();
  
          return items;
      } catch (IOException | ClassNotFoundException e) {
  
      }
    }
  </code></pre>
  
  <p>If I set relative path as above I get exception file not found.</p>
  
  <p>My question is how can I set full path to the current directory programmatically?</p>