依据配置文件properties名称获取属性的值

根据配置文件properties名称获取属性的值
      public static String getEmailInfo(String proname){
          String url = "";
          InputStream in=null;
            try {
                Properties prop = new Properties();
                in = Thread.currentThread().getContextClassLoader().getResourceAsStream("email.properties");
                prop.load(in);
                url = prop.getProperty(proname);
            } catch (Exception e) {
                e.printStackTrace();
                throw new ExceptionInInitializerError();
            }finally{
                if(in!=null)
                  try {
                      in.close();
                  } catch (IOException e) {
                      e.printStackTrace();
                  }
                }
            return url.trim();
      }