I am trying to upload a file to a ssh server in java. The server address, username and the password is correct but i am getting "Could not connect to SFTP server at "sftp://user:***@192.168.1.1/"." error.
Are you sure that there is an SFTP/SSH server running on that machine? What happens if you try connecting using a tool like WinSCP or FileZilla? The latter is also available for Linux or MacOS if you don't have Windows.