• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

copy file from local host to remote host

 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I need to copy a simple file from local file system , to another computer on the same network.

How should i do that in a simple java program ?

Thanks !
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Map a drive to that other host. Copy to a file on that mapped drive.
 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:Map a drive to that other host. Copy to a file on that mapped drive.


Thanks,
How do I do that in linux ? (both src and dest are linux).
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are many ways to do it in Linux, ssh, telnet, ftp, etc.

Please google the Java API for all those things.

You may want to take a look at Commons-Net.
 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well , I tried that from winXP to winXP on another machine and it worked great :


BUT, in order to copy to a linux machine, I tried to put this as the new File :


and it doesn't work. How should I format the new File path in order to copy to a linux FS ?


Thanks !
 
Freddy Wong
Ranch Hand
Posts: 959
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Linux isn't the same as Windows. You can't do it that way. If you prefer to do it that way. You need to create an NFS share and then mount it.
 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Freddy Wong wrote:Linux isn't the same as Windows. You can't do it that way. If you prefer to do it that way. You need to create an NFS share and then mount it.


I'm afraid I can't do that because I have to copy this file into an existing directory dedicated for that.
Is there any other way I can copy this simple file to a linux machine ?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic