Re: file.exists() timeout?
"Gilbert Ostlethwaite" <roger.varley@googlemail.com> wrote in message
news:1169805157.681405.232170@v45g2000cwv.googlegroups.com...
Is there any other reason why file.exists() would fail to find a file
that Windows can find?E.g. the Java-process is running with a different
user than
the one you use for testing. Happens very often when installing
a java application as service. By default this service is
installed as "local user" so the user is not allowed to access
ressources like a SMB-share.
AFAIK the exists-method of java.io.File is just doing a native
call and without looking into the C-sources I assume that it's
just calling the corresponding Windows-API-call.
There may be something in this. Further testing shows that my servlet
can create and read a File() object, when the physical file is located
on the same physical server that the servlet is running on. However, if
the file is located on a different server then my servlet cannot read
the file regardless whether I use a UNC path or mount the remote drive
directly via Windows Explorer.
This is using Suns JDK 1.5.0_09 on a Windows 2003 SP1 server. The file
that I'm trying to read is also on a Windows 2003 SP1 server. If I drop
back to Suns JDK 1.4.2_13 then everything works as expected.
Try producing an SSCCE that demonstrates the problem (preferably stand
alone application, instead of servlet, unless the problem only occurs in
servlets). http://mindprod.com/jgloss/sscce.html
If you can show the problem in a dozen lines of code, and show that it
works in 1.4, but not 1.5, you can probably file it as a regression bug to
Sun. Also, have you considered trying 1.6?
- Oliver