title: Why do Java source files go into a directory structure?
body: <p>as weSuppose that I am creating a Java project with the following classes</p>
  
  <ol>
  <li><code>com.bharani.ClassOne</code></li>
  <li><code>com.bharani.ClassTwo</code></li>
  <li><code>com.bharani.helper.HelperOne</code></li>
  <li><code>com.bharani.helper.support.HelperTwo</code></li>
  </ol>
  
  <p>with files put immediately under the folder 'src'</p>
  
  <ol>
  <li>src/ClassOne.java</li>
  <li>src/ClassTwo.java</li>
  <li>src/HelperOne.java</li>
  <li>src/HelperTwo.java</li>
  </ol>
  
  <p>and compile them using the command</p>
  
  <blockquote>
    <p>$ javac -d classes src/*.java (assuming that classes directory exists)</p>
  </blockquote>
  
  <p>The compiler compiles these files and put the class files in appropriate sub-directories inside the 'classes' directory like this</p>
  
  <ol>
  <li>classes/com/bharani/ClassOne.class</li>
  <li>classes/com/bharani/ClassTwo.class</li>
  <li>classes/com/bharani/helper/HelperOne.class</li>
  <li>classes/com/bharani/helper/support/HelperTwo.class</li>
  </ol>
  
  <p>Because the spec mandates that the classes should go inside appropriate directory structure. Fine.</p>
  
  <p><strong>My question is this</strong>: When I use an IDE such as <em>Eclipse</em> or <em>NetBeans</em>, they create the directory structure for the source code directory ('src' directory here) as well. Why is that? Is it mandatory? Or, is it just a convention?</p>
  
  <p>Thanks.</p>