J2SE 1.4 offers a number of new APIs to make your Java development life easier. In this article, Ray Djajadinata discusses one of those APIs: Preferences. He explains how Preferences solves typical problems in managing our applications' preferences, while still being simple and easy to use. (3,000 words)
Like a classic plot retold in a new setting, software applications have extended lifetimes when decoupled from their contextual details. This article exposes how traditional configuration files, XML-based properties, and cryptography help keep such details out of code. The result: software whose stories are told again and again, transcending even the original author's intentions. (2,500 words)
Property files let you reconfigure your Java application without recompiling. Typically, however, you need to restart your application to load the new properties. This tip shows you how to load new property files without restarting your application. (1,000 words; March 29, 2002)
5. Use filters to access resources in Java archives
How can you extract all resources from an archive that are more than a week old? Extract all classes that have been modified since September 1, 1999? Remove all images from an archive greater than 30 KB in size? This article arms the JDK 1.1 and 1.2 developer with a set of extensible classes and interfaces for filtering resources in zip files. This tip demonstrates how you can create your own filters and cache archive resources in your own Java applications. (1,600 words)
Are you still using one big property file? Using multiple property files instead can also be unwieldy, unless you have the right tools. You can layer property files easily when you use the PropDiff utility. Layered property files are good for separating settings that change for development modes like coding, testing, and deploying, and for different developers. Written by Paul Baclace, PropDiff can find the union, intersection, and difference between property files. (1,500 words; February 28, 2003)