2nd post: File() can't see drives on remote computers. Authentication issue?

C

Chris

This is a repost (slightly modified) of an issue I posted a few days ago.

It seems that the java.io.File() class can't see files and directories on
other computers on a 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?
 
S

SPG

I have seen this before..
If you actually browse to a folder using exploere, then run your app, does
it work then?

I found that to be the case with our app...
If you opena file chooser dialog, can yo ubrowse to it using that? (SWING)
 
B

Boudewijn Dijkstra

Chris said:
This is a repost (slightly modified) of an issue I posted a few days ago.

It seems that the java.io.File() class can't see files and directories on
other computers on a 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?

I have used both mapped drives and UNC paths
("\\\\otherpc\\mydir\\myfile.txt"), it always worked via "file:" URI's and the
URI constructor of File. Use 3 slashes for drive paths and 4 for UNC paths.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top