Java Properties Load from File loadProperties(String file)

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

Description

load Properties

License

Apache License

Declaration

public static Properties loadProperties(String file) 

Method Source Code


//package com.java2s;
/*//ww  w. jav  a2  s  . co m
 *   Scorpio4 - Apache Licensed
 *   Copyright (c) 2009-2014 Lee Curtis, All Rights Reserved.
 *
 *
 */

import java.io.*;
import java.util.*;

public class Main {
    public static Properties loadProperties(String file) {
        try {
            Properties properties = new Properties();
            InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(file);
            if (in != null)
                properties.load(in);
            return properties;
        } catch (IOException e) {
            return null;
        }
    }
}

Related

  1. loadProperties(Properties properties, File propertyFile)
  2. loadProperties(Properties properties, File propertyFile)
  3. loadProperties(String configFilePath)
  4. loadProperties(String configurationFileProperty, String configurationFileDefault)
  5. loadProperties(String configurationPath)
  6. loadProperties(String filename)
  7. loadProperties(String filename)
  8. loadProperties(String fileName)
  9. loadProperties(String fileName)