Win a copy of Head First Android this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

How to run FTP.exe with/without IP Address, Username and password?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I need some help.
I am trying to execute FTP.exe file with IP address from a java program using
Runtime.getRuntime().exec("path\FTP.exe someIPaddress");
statement.But what happening is, ftp is starting but not able to stay within the same program. And also it is not asking for username and password also. Even if I give the username and password along with IP address, it is not accepting.
So how do I execute this .exe file with/without options ?
Thanks.

------------------
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, you can do it this way by creating a file to use a a control file in which you write the open, setting the user and password, changing directories, putting files etc.(You can read the help associated withyour ftp program for the details) Then the command to ftp is
ftp -s:filename
You can pass this to runtime.exec() by creating a String array.
That answers the question you ask but, a better approach is to use the UrlConnection class to connect to the ftp server and communicate with it directly inside your java program

I hope this helps.
 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Carl,
This approach definitely works well or all files but the image files. The image files( gif & jpeg) come out to be empty.How can I bring these files.
Please help
Regards
Chitra
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic