看板 java 關於我們 聯絡資訊
※ 引述《xsoe (n/a)》之銘言: : ※系統環境: Sun JDK 1.4 + Eclipse 3.12 SDK, WinXP, NTFS : ※程式碼: : public static void main( String[] args ){ : File file = new File( "C:\\pagefile.sys" ); : if ( file.exists() ){ : System.out.println( "File: " + file.getAbsolutePath() ); : System.out.println( "Size: " + file.length() ); : } : } : ※結果: : File: C:\pagefile.sys : Size: 0 : ※補充說明: : 我的目的是要取得「所有檔案」的大小,但這個檔案就是不聽話… 我完全使用你的程式碼,環境也跟你差不多 唯一的差別大概就是我的 pagefile.sys 只有 4xx MB 可是我能跑的出結果來... Orz 雖然說這個檔案在 windows 當中有特殊地位 不過,如果你在檔案總管當中能夠看到他的檔案大小 那... 實在沒理由會在 Java 當中掛點 ==== 沒啥幫助的一篇文章... Orz -- 侃侃長論鮮窒礙 網站:http://www.psmonkey.idv.tw 眾目睽睽無心顫 個人版:telnet://legend.twbbs.org 煢居少聊常人事 殺頭容易告白難 歡迎參觀 Java 版(@ptt.cc)精華區 \囧/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.128.195.241