How can I go about getting the parent directory of a directory
<p>How can I go about getting the parent directory of a directory?</p>

<pre><code>File parent = new File("");
System.out.println("Parent directory : " + parent.getParent());
</code></pre>

<p>prints <code>Parent directory : null</code></p>

<p>I have a Maven multi-module project and would like to go to the parent folder then get back into each of the module folders and sub-folders getting all the jars in them.</p>

<pre><code>parent  
    distributor  
        src.controllers  
            Dist.java  
    module1  
        src.controllers  
            1App.java  
        target  
            module1-1.0-SNAPSHOT.jar-  
    module2  
        src.controllers  
            2App.java  
        target  
            module2-1.0-SNAPSHOT.jar-  
</code></pre>

<p>Above, I wold get from Dist.java to <strong>parent</strong> then into <strong>module1</strong> and <strong>module2</strong></p>