• 读取properties文件的信息


    1、properties配置文件的信息

    fcsimage_path=C://FCSImage

    2、Java代码

    public final class Config {
        private static final Object lock = new Object();
        private static volatile Properties config;
        
        private Config(){}
            
        private static Properties getInstance(){
            if (config == null)
            {
                //double lock check
                synchronized (lock) { // declare a private static Object to use for mutex
                    if( config == null ){     // have to do this inside the sync
                        config = new Properties();    
                    }
                }
                try {
                    config.load(Config.class.getClassLoader().getResourceAsStream("common.properties"));
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            
            return config;
        }
        
        public static String fcsimage_path() {
            return getInstance().getProperty("fcsimage_path");
        }
        
        
    }

  • 相关阅读:
    九九乘法表
    杨辉三角
    显示计算机界面
    完善3.2
    杨辉三角形
    100以内的素数
    九九乘法表
    杨辉三角
    九九乘法表
    杨辉三角形
  • 原文地址:https://www.cnblogs.com/zhangjinru123/p/7645409.html
Copyright © 2020-2023  润新知