Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2014066 | 1.2.0 | Mark Reinhold | P2 | Resolved | Fixed | 1.2beta3 |
Name: mc57594 Date: 02/12/97
1: Compile UNC.java and run
java UNC \\host\file
where \\host\file is the UNC filename of an existing file.
The File class reports the file as not existing. This also
failed to work in 1.0.2 Also, FileInputStream fails with
UNC pathnames; I assume FileOutputStream will also
but did not try that.
import java.io.*;
public class UNC
{
public static void main(String argv[])
{
for (int i = 0; i < argv.length; i++)
{
String fileName = argv[i];
File file = new File(fileName);
String exists = file.exists() ? "exists" : "does not exist.";
System.out.println("File " + fileName + " " + exists);
}
}
}
company - SAS Institute , email - ###@###.###
======================================================================
Another user reporting the same problem:
This was a bug in 1.1 and is still not fixed. This is a big deal.
It's a basic operating system function on win32 to be able to specify a
file as \\computername\directory\filename.ext You can't assume users
have drivenames mapped... Here's some test code:
import java.io.*;
public class UNCTest{
public static void main(String args[]){
try {
File f = new File("\\\\mymachine\\download\\test.txt");
FileOutputStream fos = new FileOutputStream (f);
PrintWriter ps = new PrintWriter(fos);
ps.println("This is a test");
fos.close();
} catch (IOException e) {
}
}
}
- backported by
-
JDK-2014066 java.io: File classes do not recognize Windows UNC filenames (win32)
- Resolved
- duplicates
-
JDK-4061699 Netbios name for classes.zip not resolved
- Closed
-
JDK-4135185 Problem saving a file to a network drive using the FileDialog in SAVE mode
- Closed
-
JDK-4118024 java.io.File.getCanonicalPath fails for UNC paths
- Closed
- relates to
-
JDK-4778561 REGRESSION:General exhaustive test of win32 pathname handling
- Resolved
-
JDK-4180841 Tools invoked via UNC pathnames cannot find their resource files (Win32)
- Resolved
(1 relates to)