I try to figure out how organize source and class files working with packages. I found a very useful tutorial. But I still have some questions.
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 "aaa.bbb.ccc" which contains class "ddd" 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?
If it is the case, will Java compiler put *.class file into a correct directory automatically?
At least I was not able to get this behavior. I set $CLASSPATH variable to be equal to "/home/myname/java/classes". I executed "javac KeyEventDemo.java" which contain "package events;". As a result I expected that javac will create a subdirectory "events" in the "/home/myname/java/classes" and put KeyEventDemo.class file to this subdirectory. It did not happened. I tried to help to javac and created "events" subdirectory by myself. I used "javac" again but it does not want to put class files to the "/home/myname/java/classes/events". What am I doing wrong?