Solved

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

Posted on 2007-11-28
11
264 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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
throw exception 21 79
going to wrong jsp page 2 70
Java program running SQL query 5 67
Overriding a method 3 14
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…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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.
Suggested Courses

751 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