FTP is a pretty loose protocol. Some servers implement features that others do not. Depending on your server, "LS" may not be supported:
5. DECLARATIVE SPECIFICATIONS
5.1. MINIMUM IMPLEMENTATION
In order to make FTP workable without needless error messages, the following minimum implementation is required for all servers:
TYPE - ASCII Non-print MODE - Stream STRUCTURE - File, Record COMMANDS - USER, QUIT, PORT, TYPE, MODE, STRU, for the default values RETR, STOR, NOOP.
The default values for transfer parameters are:
TYPE - ASCII Non-print MODE - Stream STRU - File
All hosts must accept the above as the standard defaults.
RFC 959 - File Transfer Protocol As a matter of fact, I don't see "LS" at all in the RFC. Try using a command-line FTP client to log in. Typing in "help" may get you a list of valid commands for that server.
Maybe you could take also look at Commons Net for the base classes of FTP. Around these bases classes Julian Robichaux has already written a wrapper that make the usage of FTP within java a bit less hard. You can find his code over here : http://www.nsftools.com/tips/JakartaFtpWrapper.java