获取配置文件的值配置文件在项目目录下,如果打成jar包会在jar包所在的同级目录下

  Properties p = new Properties();

  try {
   InputStream in = new BufferedInputStream(new FileInputStream("BankDebitBack.properties"));
   p.load(in);
   in.close();

String user = p.getProperty("USER","");--获取配置文件的值

  } catch (FileNotFoundException e) {

log.error(e.getMessage());
    } catch (IOException e) {

log.error(e.getMessage());
     } catch (Exception e) {
   log.error(e.getMessage());
  }

posted @ 2014-06-10 14:27  棣棣棣棣  阅读(401)  评论(0编辑  收藏  举报