public static void init ( ) { try { init ( "vdmj.properties" , Properties . class ) ; } catch ( Exception e ) { System . err . println ( e . getMessage ( ) ) ; } InputStream fis = ConfigBase . class . getResourceAsStream ( "/" + "overture.properties" ) ; if ( fis != null ) { try { java . util . Properties overtureProperties = new java . util . Properties ( ) ; overtureProperties . load ( fis ) ; final String SYSTEM_KEY = "system." ; for ( Entry < Object , Object > entry : overtureProperties . entrySet ( ) ) { String key = entry . getKey ( ) . toString ( ) ; String value = entry . getValue ( ) . toString ( ) ; if ( value . indexOf ( "/" ) != - 1 ) { // assume that this is a file path and correct it value = value . replace ( ' ' , File . separatorChar ) ; } int index = key . indexOf ( SYSTEM_KEY ) ; if ( index == 0 ) { String newKey = key . substring ( SYSTEM_KEY . length ( ) ) ; System . setProperty ( newKey , value ) ; } } } catch ( Exception e ) { throw new RuntimeException ( e ) ; } } }
When the class is initialized we call the ConfigBase init method which uses the properties file passed to update the static fields above .