For every `.java` file corresponding `.class` file will be created. The `.class` files contain Java bytecode which is meant to be executed on JVM.
For Packagers
Having our application split across many `.class` files wouldn't be very practical, so those `.class` files are assembled into ZIP files with specific layout called JAR files. Most commonly these special ZIP files have `.jar` suffix, but other variations exist (`.war`, `.ear`). They contain:
`HelloWorldApp` class used as main application
HelloWorld.java listing
How would you handle packaging software that contains `lib/junit4.jar` inside source tarball?
`Input` class used only for input of text from terminal
In this project all packages are under `src/` directory hierarchy.
It describes project's build process in a declarative way, without explicitly specifying exact steps needed to compile sources and assemble pieces together. It also specifies project's dependencies which are usually the main point of interest for packagers. Other important feature of Maven that packagers should know about are plugins. Plugins extend Maven with some particular functionality, but unfortunately some of them may get in the way of packaging and need to be altered or removed. There are RPM macros provided to facilitate modifying Maven dependencies and plugins.
JAR files
<jar jarfile="${dist}/myproject.jar" basedir="${build}"/>
jar xf something.jar
java -cp /usr/share/java/log4j.jar:/usr/share/java/junit.jar mypackage/MyClass.class
CLASSPATH=/usr/share/java/log4j.jar:/usr/share/java/junit.jar java mypackage/MyClass.class
Java is a programming language which is usually compiled into bytecode for JVM (Java Virtual Machine). For more details about the JVM and bytecode specification see link:http://docs.oracle.com/javase/specs/jvms/se8/html/index.html[JVM documentation].
Java packages
Let's create a simple hello world application that will execute following steps when run:
Name at least three methods for bundling code in Java projects