Java Properties Load loadProperties()

Here you can find the source of loadProperties()

Description

load Properties

License

Apache License

Declaration

public static Properties loadProperties() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.*;

import java.util.*;

public class Main {
    public static Properties loadProperties() {
        return loadProperties(new Properties());
    }/*from w w  w .ja va 2s .  c  o m*/

    public static Properties loadProperties(Properties props) {
        String filePath = System.getProperty("inifile");
        if (filePath != null) {
            File file = new File(filePath);
            // look for the file
            if (file.exists()) {
                try {
                    System.out.println("Loading properties from "
                            + filePath + " ...");
                    // load any properties specified in the startup file
                    props.load(new FileInputStream(file));
                } catch (IOException e) {
                    System.out.println("Error reading specified ini file!");
                }
            } else {
                System.out.println("Ini file " + filePath
                        + " not found, using defaults.");
            }
        }
        return props;
    }
}

Related

  1. loadProperties()
  2. loadProperties()
  3. loadProperties()
  4. loadProperties()
  5. loadProperties()
  6. loadProperties()
  7. loadProperties(ByteSource is)
  8. loadProperties(Class clazz, String name)
  9. loadProperties(Class clazz)