Getting started with project structure and build tools
When a project is more complex than a single class, and it usually is, then it is wise to define a project structure. We will have to decide where we store the source files, where the resource files (the ones that contain some resource for the program but are not Java source) are, where the .class
files should be written by the compiler, and so on. Generally, the structure is mainly the directory setup and the configuration of the tools that perform the build.
The compilation of complex programs cannot be feasibly done using the command line issuing javac
commands. If we have 100 Java source files, the compilation will require that many javac
commands to be issued. It can be shortened using wildcards, such as javac *.java
, or we can write a simple bash script or a BAT command file which does that. First, it will be just 100 lines, each compiling one source Java file to the class file. Then, we will realize that it is the only time that...