🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
2 messages
2 total messages Started by Zak Fri, 30 Aug 2002 15:18
java.io.File network file access
#823
Author: Zak
Date: Fri, 30 Aug 2002 15:18
16 lines
1564 bytes
I'm trying to access a file on the network from a java class. Here is a
simple example:

java.io.File f = new java.io.File("w:\");
System.out.println(f.canRead());
System.out.println(f.isDirectory()):
java.io.File[] files = f.listFiles();

in this case the W:\ drive is mapped on the server.  canRead() returns false
isDirectory return false and
files is null

I can use this same code to access any partition on the server but can't
access anything on the network whether using a mapped drive or the UNC
\\ntserver-5 .  Is this a permissions problem or something else.  I don't
get any error.
Re: java.io.File network file access
#824
Author: Shankar Unni
Date: Fri, 30 Aug 2002 15:57
25 lines
2136 bytes
Zak wrote:

> java.io.File f = new java.io.File("w:\");

You mean "w:\\", or it wouldn't compile. You can also say w:/, by the 
way, or just "w:".

> in this case the W:\ drive is mapped on the server.  canRead() 
 > returns false, isDirectory return false and files is null

Can't reproduce this. I just tried here (on WinXP), and got the expected 
behavior whether W: was an "actual" drive, a mapped (using subst) local 
directory or a mapped network share.

(Is your w: a CD-ROM, perchance?)

> I can use this same code to access any partition on the server but can't
> access anything on the network whether using a mapped drive or the UNC
> \\ntserver-5 .  Is this a permissions problem or something else.  I don't
> get any error.

In any case, you can't just open \\ntserver-5. (I hope you said 
"\\\\nt-server5" in your source!). You can't browse the shares on a 
server using the regular File API. You can, however, browse 
"\\\\nt-server5\\Some Share"), provided you have the right permissions.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads