Java Config allows easy and type-safe access to configuration properties.

Almost every application needs access to configuration settings, such as hostnames or a portnumber. This component provides access to such settings, in a convenient and simple-to-use way.

For many applications, configuration properties are stored in a Java .properties file. Java Config will verify that properties in such a file are valid, and provides a large number of useful methods to read a large variety of common data- types (from ints and booleans to filesizes, durations and MessageFormat patterns).

For more information see the Getting Started page or the frequently asked questions.

Project Goals

These are the goals Java Config tries to achieve:

  • Type-safe access: int portNumber = getConfig().getFtpPortNumber();
  • Allow an easy check on the validity of a given properties file, most likely at start-up time.
  • Support common configuration data-types like Date, URL, int and boolean.
  • Flexibility in use: no static initializers, no logging-dependencies.

If you just want to download a zip-file, go to the download page. If you would like to know more about the design, this article is a good starting point.


This is a very quick example of the features of Java Config. It shows you the type-safeness, and the start-up check on the validity of the property-file.

public class SimpleApplication {
  public static void main(String[] args) {
    String sayingHi =  getConfig().getWelcomeText();    
    boolean yesOrNo = getConfig().getMyFirstBoolean();
    int numberOfDays = getConfig().getNumberOfDays();
    java.net.URL url = getConfig().getNiceWebsite();

  private MyConfig config;

  private static getConfig() {
    if (config == null) {
        config = new MyConfig("my.properties");
        ConfigValidationResult configResult = config.validateConfiguration();
        if (configResult.thereAreErrors()) {
            // display errors here
    return config;

The sources of the this example are online . There is also more detailed example available of the initial validation of the property-file.


The easiest way to get started with Java Config is to use the zips provided at the download page .

Project License

Java Config is available under a BSD license; please read LICENSE.TXT for the official license text.

This project was donated to the open source community by Chess-iT , a very cool software company.

The design and implementation were done by Guus Bosman . This Config class is partly based on a Config class by Rolf Heller .


Your feedback is welcome.