This blog records some ideas, notes, and information of my works and studies in information technology.

Sunday, June 28, 2009

Load Properties in Java

http://www.javaworld.com/javaworld/javaqa/2003-08/01-qa-0808-property.html?page=2
Complete introduction
A simple example~

[Important!]
將設定檔放在Jar包外部執行!
final InputStream inStream = ClassLoader.getSystemResourceAsStream("EJBProp.properties");
取得的方式較簡單
重點在MANIFEST.MF中 設定Class-Path: ./
表示需從 class loader所在的位置搜尋檔案~!!

No comments:

Post a Comment