开发者

Show special hidden Files/Directories from Windows 7 in Java

Si开发者_开发知识库nce Windows 7 the directory windows/system32/drivers/etc is specially hidden. Windows 7 itself doesn't show it, but it is there if I open it manually.

Today I was playing around with a Java JFace Eclipse example (http://www.ibm.com/developerworks/library/os-ecgui1/) and was wondering that java also doesn't show the etc directory.

So how can I get all directories/Files, when using file.listFiles() ? Any ideas?


The File.listFiles() method should include normal "hidden" files in the result. If it does not, it is because of something going on at the operating system level to hide the files from the application (and not just the user).

I could not find anything in either java.io.File or the Java 7 java.nio.* extensions that mention accessing "specially hidden" files.

It could be a privilege related thing ... and if that's the case the solution is to execute the Java application with elevated privileges.

But the simple solution is for your application to keep its nose out of the Windows drivers directory tree.


As I wrote, I played around with an JFace Example, that builds up a Java based Windows Explorer. I agree with you, that a Java application should normally not do something in the Windows driver directory tree. The "specially hidden" files there, are visible with other programs like Total Commander without running this programs with other then normal rights. I assume, that Windows has some API functions to get that information. I'm just interested in a Java based solution that can show me everything, that's on my disk...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜