Java Properties Load from File loadSystemProperty(String evn, String fileName)

Here you can find the source of loadSystemProperty(String evn, String fileName)

Description

load System Property

License

Open Source License

Declaration

public static Properties loadSystemProperty(String evn, String fileName) 

Method Source Code


//package com.java2s;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Main {
    public static Properties loadSystemProperty(String evn, String fileName) {
        String tomcatHome = System.getProperty(evn);
        System.out.println("tomcat home:[" + tomcatHome + "]");
        String setupFile = tomcatHome + File.separatorChar + "conf" + File.separatorChar + fileName;
        System.out.println("system config file:" + setupFile);
        Properties prop = new Properties();
        InputStream is = null;//from  www.  j av a 2  s.  c  om
        try {
            is = new FileInputStream(new File(setupFile));
            prop.load(is);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return prop;
    }
}

Related

  1. loadRecursively(String propertiesFilename)
  2. loadRQGProperties()
  3. loadSetting(InputStream in, String key)
  4. loadSettings(String propertiesFileName)
  5. loadStrictly(File file)
  6. loadTestProperties(String filename)
  7. loadToStringFromFile(String fullFileName)
  8. loadTrimedProperties(String filename)
  9. loadUniversal(InputStream in)