This week's book giveaway is in the Artificial Intelligence forum.
We're giving away four copies of Pragmatic AI and have Noah Gift on-line!
See this thread for details.
Win a copy of Pragmatic AI this week in the Artificial Intelligence 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

FTPClient.retrieveFileStream always comes back null  RSS feed

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm trying to read the text of an XML file that is on a remote FTP server, however, the fileStream always comes back null.



The path to the file I'm trying to read is "ftp://mycompany.com/java/mul/735/Folder/ver.xml". The code right now is using "mycompany.com/java/mul/735/Folder/ver.xml" as the input for the retrievefileStream method, but I've tried all types of variants with no luck.

Any help tips welcome.





 
Sheriff
Posts: 23649
49
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this "ftp" variable an FTPClient? If so, does it have a method to connect to the FTP server? (I ask because there isn't an FTPClient method in the standard Java API so you must be referring to some other, unspecified, FTPClient class.)

I'm guessing it does. Then you should do that first. After that, then assuming the server makes your current directory its root, the name of the file you want is "/java/mul/735/Folder/ver.xml". (Use a command-line FTP client to find out what your actual working directory is on the server, and start from there.)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!