Java Properties Load from File loadPropertiesFile(String path)

Here you can find the source of loadPropertiesFile(String path)

Description

load Properties File

License

Open Source License

Declaration

public static Properties loadPropertiesFile(String path) 

Method Source Code

//package com.java2s;
/*****************************************************************************
 * Copyright (c) 2015 Chris J Daly (github user cjdaly)
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from w  w w  . j av a  2s  .  co  m*/
 *   cjdaly - initial API and implementation
 ****************************************************************************/

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

import java.util.Properties;

public class Main {
    public static Properties loadPropertiesFile(String path) {
        Properties properties = new Properties();

        try (BufferedReader reader = new BufferedReader(
                new FileReader(path))) {
            properties.load(reader);
        } catch (FileNotFoundException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }

        return properties;
    }
}

Related

  1. loadPropertiesFile(final File file)
  2. loadPropertiesFile(String fileName)
  3. loadPropertiesFile(String fileName)
  4. loadPropertiesFile(String filePath)
  5. loadPropertiesFile(String filePath)
  6. loadPropertiesFile(String propertiesFileName)
  7. loadPropertiesFile(String propFile)
  8. loadPropertiesFile(String propFilePath)
  9. loadPropertiesFromClasspath( final String filename)