1. 程式人生 > >java讀取properties檔案對應值

java讀取properties檔案對應值

tag.properties:src下的properties檔案。

1:定義

public static String urlProperty;    

2:方法

   Properties properties = new Properties();
        try{
        properties.load(this.getClass().getClassLoader().getResourceAsStream("tag.properties"));
        }catch(IOException e){
            e.printStackTrace();
        }
        urlProperty = properties.getProperty("ws.url.NAUW.BlockChain.WS");