龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 软件开发 > JAVA开发 >

从配置文件读取信息

时间:2009-12-23 15:42来源:未知 作者:admin 点击:
分享到:
private void loadPerpro() { Properties props = new Properties(); try { String sysPath = System.getProperty("user.dir"); System.out.println("application path : " + sysPath); FileInputStream fis = new FileInputStream(new File(sysPath+"/datato

  private void loadPerpro() {
      Properties props = new Properties();
        try {
         
          String sysPath = System.getProperty("user.dir");
          System.out.println("application path : " + sysPath);
          FileInputStream fis = new FileInputStream(new File(sysPath+"/datatoldapsyn.perproties"));
          props.load(fis);
          this.strConnectString=(String)props.getProperty("dbConnectString");
          this.strUser = (String)props.getProperty("dbUser");
          this.strPwd = (String)props.getProperty("dbPwd");
          this.ldapHost = (String)props.getProperty("ldapHost");
          this.ldapOrg = (String)props.getProperty("ldapOrg");
          this.ldapDN = (String)props.getProperty("ldapDN");
          this.ldapPWD = (String)props.getProperty("ldapPWD");
        }
        catch (FileNotFoundException ex) {
          ex.printStackTrace();
        }
        catch (IOException ex1) {
          ex1.printStackTrace();
        }

  }<?XML:namespace prefix = o ns = "urn:schemas-microsoft-com:Office:office" />


  
精彩图集

赞助商链接