Handmaking JAR files
The default Java application delivery mechanism is JAR files, which are ZIP archives with some extra information that makes them executable by Java. You can store class files (compiled Java files) and resources together in the JAR file.
Most of the IDEs you use will create a JAR file from your project, but in this section, we will review how it works under the hood.
Note
Besides the direct download, there are also Java Web Start and browser plugin options, but they are being deprecated by Oracle so I'll leave them out of this book's scope.
Running the demo project
Let's consider the next project structure for the following examples:

I won't print all the source code here as the exact content is not important for the topic. It's an application that opens the second window loaded from FXML. As always, the source code can be found in the Chapter11
folder on our GitHub.
Before we package anything, we need to compile our files by calling javac
. The following CLI commands will compile...