欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

properties读取,,import java.

来源: javaer 分享于  点击 22397 次 点评:189

properties读取,,import java.


import java.io.IOException;  import java.io.InputStream;  import java.util.Properties;  public class readproperties {      public static void main(String[] args) {          //配置文件放在src下          InputStream inStream= (InputStream) readproperties.class.getClassLoader().              getResourceAsStream("ApplicationResources.properties");//.ApplicationResources.properties          Properties properties=new Properties();          try {              properties.load(inStream);          } catch (IOException e) {              e.printStackTrace();          }          String value=properties.getProperty("key");          System.out.println("getProperty...................."+value);      }  }  
相关栏目:

用户点评