<target name="dist" depends="compile"
description="Generate jar">
<mkdir dir="${dist}/lib"/>
<target name="init" description="Create build directory">
<mkdir dir="${build}"/>
Telling JVM which Java class contains `main()` method
The classpath is a way of telling JVM where to look for user classes and 3rd party libraries. By default, only current directory is searched, all other locations need to be specified explicitly by setting up CLASSPATH environment variable, or via `-cp` (`-classpath`) option of a Java Virtual Machine.
The detailed description of JAR file format is in the link:http://docs.oracle.com/javase/8/docs/technotes/guides/jar/jar.html[JAR File Specification].
The sample project can be compiled to a bytecode by Java compiler. Java compiler can be typically invoked from command line by command `javac`.
They can also contain additional bundled software which is something we don't want to have in packages. You can inspect the contents of given JAR file by extracting it. That can be done with following command:
To better illustrate various parts of Java packaging we will dissect simple Java ``Hello world'' application. Java sources are usually organized using directory hierarchies. Shared directory hierarchy creates a namespace called `package` in Java terminology. To understand naming mechanisms of Java `packages` see link:http://docs.oracle.com/javase/tutorial/java/package/namingpkgs.html[Java package naming conventions].
To illustrate certain points we artificially complicate things by creating:
What are contents of a typical `JAR` file?
What is a CLASSPATH environment variable and how can you use it?
What is a pom.xml file and what information it contains?
What is the difference between `java` and `javac` comands?
What is the difference between JVM and Java?
While unlikely, it's still possible that you encounter a project whose build is managed by plain old Makefiles. They contain a list of targets which consist of commands (marked with tab at the begining of line) and are invoked by `make` _target_ or simply `make` to run the default target.
Wrapper scripts