• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to read from file from a remote machine

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, i have had a look at similar questions on here, but cannot find a solution

How do I read from a remote windows machine that requires password and username. Please note the C drive is shared. It requires login, I don't want to use ftp, just java io.

- is not working, it requires login

I am trying


But it is not working

I have also tried


But I get java.lang.IllegalArgumentException

URI has an authority component
please help
 
Rancher
Posts: 1337
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A Windows JDK should be able to access remote SMB shares given the right file syntax.

If the client is something else (like some kind of Unix-ish box) then you'd need to use the jCIFS library (the API of which closely resembles File, FileInputStream and FileOutputStream, so it's easy to use).
 
Sege Stephen
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Lester

Thanks the quick reponse. The remote machine is a windows 2003 server. With using the username and password, I get

"Logon failure: unknown user name or bad password"

What is the correct syntax for passing the password and username with the server & files details?
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you passing the domain name as well? Often you need to specify the user name as domain\user.
 
Sege Stephen
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Rob, I am not passing the domain. Although I saw some examples on the internet where the domain are being passed.

I had solved this problem by mounting the drive. For anyone else wanting to know the solution, I mounted the drive by assigning it an unused drive. I used the process command -
net use F:/servername/shared \user username password
 
The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic