Solved

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

Posted on 2007-11-28
11
224 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
 

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

758 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now