Java Properties Load from File loadConfiguration(String file)

Here you can find the source of loadConfiguration(String file)

Description

Load a Java properties file into the system properties.

License

Open Source License

Declaration


public static void loadConfiguration(String file) throws IOException 

Method Source Code

//package com.java2s;
/*/*w w w  .j a v a 2  s .c  o m*/
 * Copyright 2005--2008 Helsinki Institute for Information Technology
 *
 * This file is a part of Fuego middleware.  Fuego middleware is free
 * software; you can redistribute it and/or modify it under the terms
 * of the MIT license, included as the file MIT-LICENSE in the Fuego
 * middleware source distribution.  If you did not receive the MIT
 * license with the distribution, write to the Fuego Core project at
 * fuego-core-users@googlegroups.com.
 */

import java.io.FileInputStream;

import java.io.IOException;

import java.util.Iterator;

import java.util.Properties;

public class Main {
    /** Load a Java properties file into the system properties.
     */

    public static void loadConfiguration(String file) throws IOException {
        Properties p = new Properties();
        FileInputStream in = new FileInputStream(file);
        p.load(in);
        in.close();
        for (Iterator i = p.keySet().iterator(); i.hasNext();) {
            String key = (String) i.next();
            System.setProperty(key, p.getProperty(key));
        }
    }
}

Related

  1. loadConfig(File settingsFile)
  2. loadConfigByPath(String path)
  3. loadConfigProperties()
  4. loadConfigProperties()
  5. loadConfiguration()
  6. loadConfiguration(String filePath)
  7. loadCredentials(File credentials, String credentialsAppend)
  8. loadCryptoProperties()
  9. loadDBProperties(String dbConn)