Re: [問題] java.util.Properties的問題

看板java作者 (愚人)時間19年前 (2007/03/17 12:53), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
※ 引述《ogre0403 (肚子餓)》之銘言: : 我用Properties來讀我的設定檔,可是很奇怪的是我只打檔名會出現 : FileNotFoundException, : 例如:props.load(new FileInputStream("table.prop")); : 可是假如我打出完整的路徑就可以了 : 例如: : props.load(new FileInputStream : ("D:\\JAVA\\workspace\\Project_test\\src\\table.prop")); : 我是用eclipse,property檔和其他檔都放在同個目錄下, : 有人有遇過這個奇怪的問題嗎 如果你用了 src 與 bin 分開 那就不會在 bin\\table.prop 找到啊 @"@ 不然你印一下 System.out.println(this.getClass().getClassLoader() .getResource("").getPath()); 或 System.out.println(new File("").getAbsolutePath()); 就會明白你執行的路徑了 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.161.127.184
文章代碼(AID): #15-tHUZi (java)
文章代碼(AID): #15-tHUZi (java)