Question: Suppose one has a java project which consists of several packages, subpackages etc, all existing in a folder "source". Is there a direct way to copy the structure of the folders in "source" to a "classes" folder and then recursively compile all the .java files, placing the .class files in the correct locations in "classes"?

Answer: 
For larger projects a recommend using a build tool like [Maven](http://maven.apache.org) or the newer and faster [Gradle](http://gradle.org). Once you've configured one of them for your needs, it's very easy to do the job by calling `mvn build` or `gradle build`.

If these tools seem to heavy for your purpose, you may have a look at [Ant](http://ant.apache.org). A simple ant example:

```
<project default="compile">
<target name="compile">
    <mkdir dir="bin"/>
    <javac srcdir="source" destdir="bin"/>
</target>
</project>

```

and then run `ant` from the command line. See [this thread for further information](https://stackoverflow.com/questions/6623161/javac-option-to-compile-recursively).
* There are no "bin files" in Java, this language only compiles
bytecode
* [Compiling multiple packages using the command line in Java](https://stackoverflow.com/questions/3512603/compiling-multiple-packages-using-the-command-line-in-java)
* Eclipse : <https://stackoverflow.com/a/7218929/351861>
* via console : `javac folder1/*.java folder2/*.java folder3/*.java`