Chapter 5. Packaging projects

 

This chapter covers:

  • 5.1 Working with files
  • 5.2 Introducing mappers
  • 5.3 Modifying files as you go
  • 5.4 Preparing to package
  • 5.5 Creating JAR files
  • 5.6 Testing with JAR files
  • 5.7 Creating Zip files
  • 5.8 Packaging for Unix
  • 5.9 Working with resources
  • 5.10 Summary

We can now compile and test our diary classes, using Ant, <javac>, and <junit>. This code can be turned into a JAR library. It can be used inside our application, or it can be redistributed for other people to use.

This brings us and our build file to the next problem: packaging a program for reuse and redistribution. We want to take the compiled classes and create a JAR file that can itself be bundled into some source and binary redistribution packages���such as Zip and tar files���for different platforms. We will then be able to execute the JAR file and upload the Zip and tar files to servers. We are effectively releasing our diary as a library, on the basis that having passed its tests, it���s ready for use.

What else does a project need to do before releasing a Java program?

  • Create the documentation.
  • Write any platform-specific bootstrap scripts, batch files, or programs.
  • Write any installer configuration files, such as Java Web Start files.
  • Build the application and package it into a JAR file.
  • Pass the test suite.
  • Bundle the JAR, the documentation, and any other files into redistributable packages (usually Zip and tar files).

5.1. Working with files

5.2. Introducing mappers

5.3. Modifying files as you go

5.4. Preparing to package

5.5. Creating JAR files

5.6. Testing with JAR files

5.7. Creating Zip files

5.8. Packaging for Unix

5.9. Working with resources

5.10. Summary