Re: Reading a file from another machine on the network



mineshdesai@xxxxxxxxx schrieb:
On Mar 14, 4:14 pm, Michael Rauscher <michlm...@xxxxxx> wrote:
mineshde...@xxxxxxxxx schrieb:

Hello,
I have a requirement in which i want to read a file from another
machine in the network. And also the machine is password protected.
Which protocol?



Can any one help me out in this.
I tried doing it in following way,
URI uri = URI.create("file://9.182.198.145/shared");
File file = new File(uri);
As i excute this code i get an exception as:
java.lang.IllegalArgumentException: URI has an authority component
Seems like the above is treated as UNC name which can't be used accross
platforms. E. g. Linux would look for a file 'shared' in directory
'9.182.198.145'.

Under windows you might want to try
"file://username:passw...@xxxxxxxxxxxxx/shared"

but perhaps it's easier to mount the share via

net use X: \\9.182.198.145\Shared <password> /user:<username>

and then access the file via X: ;)

Bye
Michael

Michael Thanks for reply,

I will explain you the requirement,

I have few machines on the network, i want to access a file under
"shared" folder on the machine with i.p address as 9.182.198.145

and all the systems have windows OS.

One more thing i tried with following code and i got the same
exception

Sorry, I was wrong.

Either you've got access to the Share, then you can simply use the UNC name (\\9.182.198.145\Shared). Otherwise I thinkg you'd have to map the Share to a drive letter or to have a look at http://jcifs.samba.org ;)

Bye
Michael
.



Relevant Pages

  • Re: VB.Net file access problem with UNC
    ... It is compatible with Windows XP - it says so. ... The only problem is when the system is disconnected under UNC. ... This is a legacy network that I have NO control over - and, ... > I didn't even think that Artisoft supported Lantastic any more! ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Web service fails to run on Windows 2003
    ... at this point you have no more to see from exception. ... I don't think it is a network issue since I tried to call and run the ... I call the web service from the windows ... FUNCTION: ProcessFile: Loop for processing lines ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Crossplatform URLs to access Samba shares
    ... our network. ... I have linked to many files throughout the Intranet by ... it works great for almost all of my users (Windows) with the exception ...
    (comp.protocols.smb)
  • Re: Using VS2005 over a server share
    ... I have just copied it to another computer on the network where I store all ... If I had to hazzard a guess, i'd say it's because "Hosting on a UNC share ... is not supported for the Windows XP Platform." ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Windows Service UnauthorizedAccessException
    ... My drive is using its UNC. ... Do I need to do something different for the Windows Service on my ... on a network share. ...
    (microsoft.public.dotnet.languages.csharp)