title: Java not compiling .class files under $CLASSPATH
body: <p>I'm trying to figure out how organize source and class files working with packages. I found a very useful <a href="http://java.sun.com/docs/books/tutorial/java/package/managingfiles.html" rel="nofollow noreferrer">tutorial</a>. But I still have some questions.</p>
  
  <p>As far as I understood it is a good practice to have an isomorphism between name of packages and name of the directories where elements of a package are stored. For example if I have a package named <code>aaa.bbb.ccc</code> which contains class <code>ddd</code> it is a good practice to have a class file called "ddd.class" and located in "$CLASSPATH/aaa/bbb/ccc/". Did I get it right?</p>
  
  <p>If it is the case, will Java compiler put *.class files into the correct directory automatically?</p>
  
  <p>I was not able to get this behavior. I set the <code>$CLASSPATH</code> variable to  <code>"/home/myname/java/classes"</code>. I executed <code>javac KeyEventDemo.java</code> which contains <code>package events;</code>. I expected that javac will create a subdirectory <code>events</code> under <code>/home/myname/java/classes</code> and put the <code>KeyEventDemo.class</code> in this subdirectory. </p>
  
  <p>It did not happen. I tried to help to javac and created "events" subdirectory by myself. I used <code>javac</code> again but it does not want to put class files under "/home/myname/java/classes/events". What am I doing wrong?</p>