In apache commons net ftpclient there is the ftpClient.printWorkingDirectory() to get a string of the current directory.
How can I achieve the same thing with jsch sftp client? there is a method called realpath(String) but it doesn't seem right and I can't get it to work.
Any suggestions?
SFTP doesn't have a concept of current directory or "working directory", that's why you can find nothing. All paths in SFTP must be absolute. Use of relative paths is not defined by standard and is server-specific (consequently you might get big surprise when doing the same operation on various servers).