java 读取 properties 属性文件
2014-12-28 09:24
381 查看
<pre name="code" class="java">/** *读取properties属性文件 * @throws IOException */ @Test public void testReadProperties() throws IOException{ //创建 Properties Properties prop = new Properties(); //获得输入流 InputStream in = getClass().getClassLoader().getResourceAsStream("resources/jdbc.properties"); //Reads a property list (key and element pairs) from the input byte stream. prop.load(in); //Searches for the property with the specified key in this property list. String user = prop.getProperty("user"); System.out.println(user); }jdbc.properties
driver=com.mysql.jdbc.Driver jdbcUrl=jdbc:mysql://localhost:3306/showPictures user=root password=wyc226
相关文章推荐
- java中经常用到的读写配置文件的信息properties属性的写入,读取例子
- java读取Properties属性文件的方法
- 警告:不能读取 AppletViewer 的属性文件: C:\Users\Administrator\.hotjava\properties
- Java学习笔记——JDBC读取properties属性文件
- java读取属性文件properties文件
- Java读取属性Properties文件的方法
- 利用java.util.Properties读取属性文件
- 不能读取 AppletViewer 的属性文件: C:\Users\Administrator\.hotjava\properties
- 读取资源属性文件(properties)java.util.ResourceBundle使用详解
- Java中读取properties属性配置文件内容方法
- java读取properties属性文件值方法
- Java读取属性Properties文件的方法
- java读取properties 属性文件
- java读取Properties属性文件的方法
- Java学习笔记——JDBC读取properties属性文件
- java读取properties属性文件
- Hibernate从Java属性文件(properties)读取配置信息
- java代码及xml文件读取properties属性文件的方法
- Java系列-如何读取.properties属性文件
- java读取和修改Properties属性文件的value值