access error with FileChannel.open(dir) on windows
Alan Bateman
Alan.Bateman at oracle.com
Fri Feb 22 19:19:40 UTC 2013
On 22/02/2013 19:07, Akhil Arora wrote:
> The following simple program throws access denied on windows7 for any
> directory path passed as the first arg. Works fine on linux, and works
> fine for args that are file. Verified that the exception occurs on a
> coworker's windows7 as well. Is this a bug or am I doing something
> wrong? Thanks
Whether you can open a directory as a regular file is highly platform
specific. In this case it's just the error coming from Windows.
BTW: If you are just opening a FileChannel for reading then
FileChannel.open(path) should do it.
-Alan.
More information about the nio-dev
mailing list