[Advanced-java] network file access

Moisei, Constantin moisei at BIWORLDWIDE.com
Fri Mar 28 14:55:17 2003



> Hello there,
> 
> I face the following problem.
> 
> I'm in a large network with Novell, windows, Unix servers. Basically it's
> a ms network using Novell. I have some Unix servers that use samba to
> allow some files to be read over the network. From a windows machine I can
> easily read any file that is made available in smb.config file now when I
> move the code over a Unix box it's not working anymore. I assume that user
> and password are required to validate the access
> 
> Here bellow is the code I wrote
> 
> 	try
> 	{
> 		URL url = new URL( "file://server/folder/file" );
> 		URLConnection urlCon =  url.openConnection();
> 		BufferedReader br =  new BufferedReader( 
> 			new InputStreamReader ( urlCon.getInputStream() ),
> 10240 );
> 		out.println( br.readLine() );
> 	}
> 	catch( Exception e)
> 	{
> 		out.println( "Ex:" + e.getMessage() );
> 	}
> 
> Practically this is part of a web application that works great on ms
> machines but fails when deployed to a Unix server. 
> 
> It's there any idea that may help me to solve this network file access ?
> Should I try to ask administrator to make that file available through
> anonymous ftp ? 
> 
> I'm looking forward to hear your thought!
> 
> Thanks in advance,
> MC
> 
>