Other | Other |
---|---|
1.1.6 1.1.6Fixed | 1.2.0Fixed |
Duplicate :
|
|
Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
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) { } } }
|