f



Maybe it's a security problem? File() can't see remote drives

It seems that the java.io.File() class can't see files and directories on
other computers on a particular Windows network.

For example:

C:\ is a local drive
Z:\ is a mapped drive on another computer

(new File("C:\\mydir\myfile.txt")).exists() == true;
(new File("Z:\\mydir\myfile.txt")).exists() == false;

myfile *does* exist on the Z: drive. You can navigate to it using Windows
Explorer, click on it, and edit it. You can also cd to this drive at the
command prompt.

My best guess is that this is a security/authentication issue. The network
uses Active Directory to authenticate users and give them access to shared
drives. But once the user is authenticated by Windows, I can't see why
Windows would deny access to a drive to an application being run by the same
user.

Has anyone seen this problem before? Why would Windows Explorer be able to
see this file but not Java?



0
Chris
1/10/2005 6:42:47 PM
comp.lang.java.security 1502 articles. 0 followers. Post Follow

2 Replies
1128 Views

Similar Articles

[PageSpeed] 54

> Has anyone seen this problem before? Why would Windows Explorer be able to
> see this file but not Java?

I remember having this kind of problem before; it was not really
security-related. I don't know exactly why, but the drive mapping had to be
made available explicitly to the DOS box in which I ran the Java
application. This is done with the net use command, I seem to remember.

There might also be an elegant, programmatic way to do this inside your
program?

Good luck,

Mich�le Ouellet.


0
Michele
1/11/2005 11:36:37 AM
Chris wrote:

> It seems that the java.io.File() class can't see files and directories on
> other computers on a particular Windows network.
> 
> For example:
> 
> C:\ is a local drive
> Z:\ is a mapped drive on another computer
> 
> (new File("C:\\mydir\myfile.txt")).exists() == true;
> (new File("Z:\\mydir\myfile.txt")).exists() == false;
> 
> Has anyone seen this problem before? Why would Windows Explorer be able to
> see this file but not Java?

This problem exists, e.g., with applications running as services
under LocalSystem account. For instance, all Tomcat webapps when
installed as service/LocalSystem. LocalSystem cannot see remote
drives (no matter whether mapped to a drive name or not, UNC paths
do not work either). Either change the logon account to somebody
entitled, or start a net use batch with a correct login.

Andreas

-- 
---------------------------------------------
Andreas Jaeger
http://afi.uni-muenster.de
afi - Institut f�r Agrar- und Forstinformatik
an der Universit�t M�nster
---------------------------------------------

0
Andreas
1/11/2005 1:10:41 PM
Reply: