Solved

Moving a file from the client to a server - FTP?

Posted on 2007-11-28
11
251 Views
Last Modified: 2010-03-30
I have a java app that produces a zip file.  After the zip file is created it needs to move the zip file from the client machine to a server.  What is the best way to move the zip file.  Is FTP the best way?
0
Comment
Question by:Jaziar
  • 6
  • 4
11 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366058
If you have a network share you can write it directly, otherwise yes
0
 

Author Comment

by:Jaziar
ID: 20366085
How would you handle it if you had a network share?  Can you show an example?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366145
Try

new FileOutputStream("//machine_name/share_name/file");

then copy the stream
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:Jaziar
ID: 20366197
Just found out it is a solaris box, so I am guessing it will have to be FTP.  Do you have any examples of ftp code for me.  I will increase the points for you're time


0
 

Author Comment

by:Jaziar
ID: 20366199
Points increased
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366264
>>Just found out it is a solaris box,

That doesn't make any difference if you have a mounted share:

new FileOutputStream("machine_name:/share_name/file");
0
 

Author Comment

by:Jaziar
ID: 20366304
I was told that FTP is the only way.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 20366327
No share, then


URLConnection conn = new URLConnection("ftp://username:password@solarisbox/x/y/filename");
conn.setDoOutput(true);
OutputStream out = conn.getOutputStream();
// Now write to it - path will have to exist

Open in new window

0
 
LVL 17

Expert Comment

by:contactkarthi
ID: 20366535
this tutorial here lets you to upload or download thru FTP

http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20366751
Otherwise use an FTP API such as Commons Net
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 20367762
:-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
javap bin 2 40
object oriented programming comparison 5 77
How to determine if a string is a valid SHA value 7 35
ejb entity bean example issue 2 16
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

808 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