properties文件读取配置信息

public static void main(String[] args){
        String printerName="";
        String path = "C:\\BarCodeConfig\\Printer.properties";
        Properties prop = new Properties();
        FileInputStream fis;
        try {
            fis = new FileInputStream(path);
            prop.load(fis);
            fis.close();
            printerName= prop.getProperty("printerName");
        } catch (FileNotFoundException e) {
            System.out.println(e);
        } catch (IOException ex) {
            System.out.println(ex);
        }
        System.out.println("NAME:"+printerName);
           
    }

 

posted @ 2015-05-14 17:21  zxczxczxc123  阅读(126)  评论(0编辑  收藏  举报