使用config.properties文件
来源:互联网 发布:银行表外业务数据 编辑:程序博客网 时间:2024/05/16 14:29
1. properties 文件就是文本文件,就像一楼说的,创建一个文本文件再改名就好了。
2. properties 文件格式就是key=value形的文件,#为注释行。比如:
#下面是个例子
userid = userID
password = user password
2. properties 文件格式就是key=value形的文件,#为注释行。比如:
#下面是个例子
userid = userID
password = user password
dburl = jdbc:db2://111.111.111:3333/sampledb
在java文件中读出config.properties
package Tes t ;import java . io . IOException ;import java . u t i l . Prope r t i e s ;public c l a s s Tes t {public s t a t i c void main ( S t r ing [ ] args ) {Prope r t i e s c o n f i g F i l e = new Prope r t i e s ( ) ;t ry {c o n f i g F i l e . load ( Tes t . c l a s s . getClassLoader ( ) .getResourceAsStream( " conf ig . prope r t i e s " ) ) ;S t r ing name = c o n f i g F i l e . getProper ty ( "name" ) ;System . out . pr int ln (name ) ;} cat ch ( IOException e ) {e . pr intSt a ckTr a c e ( ) ;}}}
0 0
- 使用config.properties文件
- 关于获取config.properties文件内容
- config.properties
- config.properties
- Properties文件使用
- Properties文件使用
- properties文件的使用
- properties文件的使用
- .properties 文件的使用
- .properties文件的使用
- properties文件使用
- Web.config文件使用
- Web.config文件使用
- Web.config文件使用
- java 读取properties文件,运用 使用properties
- web jsp通过classes 读取config properties文件
- 使用 SDLX 处理 *.properties 文件
- 使用Properties读取XML文件
- android phonegap 页面跳转进度条
- Linux文件共享(一)——进程与打开文件
- Which is better: AMP or SMP?
- 回收站不小心删了的文件怎么恢复
- 如何使用 iOS 7 的 AVSpeechSynthesizer 制作有声书(2)
- 使用config.properties文件
- C++中的 Round(),floor(),ceil()
- c++ new 和 不 new创建出来的对象有什么区别
- MySQL体系结构
- 子弹头摄像机提供了最有效的数字视频监控系统
- TabHost
- 关于c++与java程序运行的效率困惑求解释
- Android Service 服务(一)—— Service
- 一道简单的求约数的个数问题