Java Properties Load from File loadDefault(String _file_path)

Here you can find the source of loadDefault(String _file_path)

Description

load Default

License

Open Source License

Declaration

public static Properties loadDefault(String _file_path) 

Method Source Code

//package com.java2s;
/*// www .ja v a  2  s. co  m
 * Copyright 2010 Antoine Seilles (Natoine)
 *   This file is part of properties-utils.
    
model-annotation is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
model-annotation is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.
    
You should have received a copy of the GNU Lesser General Public License
along with model-annotation.  If not, see <http://www.gnu.org/licenses/>.
    
 */

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import java.io.IOException;

import java.util.Properties;

public class Main {
    public static Properties loadDefault(String _file_path) {
        // create and load default properties
        Properties defaultProps = new Properties();
        FileInputStream in;
        try {
            in = new FileInputStream(_file_path);
            defaultProps.load(in);
            in.close();
        } catch (FileNotFoundException e) {
            System.out.println("[PropertiesUtils.loadDefault] no properties file to load for default properties");
            e.printStackTrace();
        } catch (IOException e) {
            System.out.println("[PropertiesUtils.loadDefault] pb with file to load for default properties");
            e.printStackTrace();
        }
        // create application properties with default
        return new Properties(defaultProps);
    }
}

Related

  1. loadConfiguration(String file)
  2. loadConfiguration(String filePath)
  3. loadCredentials(File credentials, String credentialsAppend)
  4. loadCryptoProperties()
  5. loadDBProperties(String dbConn)
  6. loadDefaultConfiguration()
  7. loadDefaultProps(Properties deployProps)
  8. LoadDeployedObjects(String outputDirectory)
  9. loadEnv(final String configFilePath)