Solved

Copy file from one unix server to another using java.

Posted on 2007-03-18
5
2,719 Views
Last Modified: 2007-12-19
I want to copy a file placed at server1 to server2 using java program (Both servers have UNIX platform). Please let me know how can i do this?
Regards,
R
0
Comment
Question by:rajneetbhatia
5 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 25 total points
ID: 18746836
You can copy in a natural way if the destination is exported

http://examples.oreilly.com/jenut/FileCopy.java

Let me know if you need more info
0
 
LVL 6

Assisted Solution

by:SamsonChung
SamsonChung earned 25 total points
ID: 18748064
(I am not entirely sure, but the following is what i would have done)

Create a TCP connection, server and client. (two program, or one if you are really good)

take the file, read it, store it as a serializable Object. (try FILE class)

then set the object over to the other side, which is waiting for the Object.

Once received, recreate the file from the object.
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18750384
If you have access to the shared folder on the remote system where you want to copy the file you can just specify the path while copying and Java will take care of it (ensure you have permissions to copy) - sockets are not needed in that case.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet example 11 49
arguments to jar 5 35
Can anyone please tell me why i can not find ID  investorCoolGrid inside the jsp page? 1 22
jboss wildfly 10.1 10 240
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question