jsch

ANT can't find specific libraries

一曲冷凌霜 提交于 2019-12-12 14:33:16
问题 I am trying to use the SSHEXEC ANT task, which requires the JSCH library. When I try to use an SSHEXEC task, I get the following: BUILD FAILED /home/www/test/build/build.xml:140: Problem: failed to create task or type sshexec Cause: the class org.apache.tools.ant.taskdefs.optional.ssh.SSHExec was not found. This looks like one of Ant's optional components. Action: Check that the appropriate optional JAR exists in -/usr/share/ant/lib -/root/.ant/lib -a directory added on the command line with

SFTP Read all files in directory

a 夏天 提交于 2019-12-12 08:56:08
问题 I have created a successful connection using SFTP com.jcraft.jsch I also created a directory folder under HostDir like: channelSftp.mkdir("sftp.test"); Now i want to read all file/folder names under host directory, I do not see any appropriate method or example. thanks 回答1: Done it using this .. ChannelSftp sftp = (ChannelSftp) channel; sftp.cd(hostDir); Vector<String> files = sftp.ls("*"); for (int i = 0; i < files.size(); i++) { Object obj = files.elementAt(i); if (obj instanceof com.jcraft

How to get list of Files from SFTP Server in android?

自闭症网瘾萝莉.ら 提交于 2019-12-12 04:36:13
问题 I developed a code but it doesn't work.please help me. ChannelSftp sftpChannel = (ChannelSftp) channel; try { Vector ls=sftpChannel.ls("/home/"); for(int i=0;i<ls.size();i++){ t.setText("\n"+ls.get(i)+"\n"); } } catch (SftpException e1) { // TODO Auto-generated catch block } Here is the Exception: 11-06 12:29:15.801: E/AndroidRuntime(9624): android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. 11-06 12:29:15.801:

How to catch exception caused by external JARs

我怕爱的太早我们不能终老 提交于 2019-12-12 04:13:05
问题 I have a scenario like this: I am trying to execute a command (df -h i.e command to find disk free space ) on a database server. I am trying to do so by using two JAR files i.e. jsch-0.1.51.jar and ganymed-ssh2-build210.jar . Now when there is any worng credentails entered , It causes the below exception com.jcraft.jsch.JSchException But when i try to catch that exception it says: Unreachable catch block for JSchException. This exception is never thrown from the try statement body and the

TCP Connection over a secure ssh connection

北城余情 提交于 2019-12-12 04:12:47
问题 I am trying to use JSCH to connect to a remote server and then from that server open a telnet like session over a tcp/ip port. Say connect to server A, and once connected issue a tcp connection to server B over another port. In my webserver logs I see a GET / logged but not GET /foo as I would expect. ANything I m missing here? (I do not need to use Port forwarding since the remote port is accessible to the system I am connected to) package com.tekmor; import com.jcraft.jsch.*; import java.io

JSCH Channel Shell, Input / Output

帅比萌擦擦* 提交于 2019-12-12 00:35:50
问题 I am having some issues using JSCH and sending commands to shell. I have a console GUI Window setup and system.out has been redirected to the TextArea and this works fine, however i am unable to input any commands Here is the connect code for the session this.channel=session.openChannel("shell"); PipedInputStream pip = new PipedInputStream(40); this.channel.setInputStream(pip); PipedOutputStream pop = new PipedOutputStream(pip); PrintStream print = new PrintStream(pop); this.channel

Android SFTP resumable download file

巧了我就是萌 提交于 2019-12-11 18:42:52
问题 In my project I want to use SFTP download process.Specially for resume download.. I used this lib for my android download project. I used JSCH library for this. I know only this library if there is any other method or API please let me know for resume download process I follow the standard example which on its website.. SFTP Resume Download But its not working .. Actully value of "i" display -1 so , It not coming inside the loop please help me to resolve the issue... Anybody facing same issue

How to set an image in android app with sftp input stream?

匆匆过客 提交于 2019-12-11 15:12:35
问题 I'm using Android Studio to build an application. In this app, I want to get an image in a specific folder from a linux host using Jsch sftp , and set this new picture to an already-existing imageview. But unfortunately the picture doesn't show up. The following are the codes for this so far: MainActivity.java package com.example.picture_controller_2; import android.graphics.drawable.Drawable; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.app

Open SSH connection on specific network interface (JSch)

心不动则不痛 提交于 2019-12-11 12:45:40
问题 How can I configure JSch client to communicate using network interface other than default one? 回答1: I do not think that it is possible. I have the same requirement and checked the source code provided along with JSch. The plain Socket is created without a local address or port. 回答2: You can implement the SocketFactory interface to create a custom socket with a specified source interface, and then use session.setSocketFactory(...) to plug it into your JSch session. 来源: https://stackoverflow

SFTP to a remote location without a password/key pair

北城以北 提交于 2019-12-11 12:21:32
问题 We are trying to provide an SFTP adapter in a Spring based environment to transfer files from local to either local or remote server.But, we dont have any password configured for the users in the remote location. All implementations like apache-commons VFS or Jsch require password or private key pairs to do file transfer. We cannot configure a password to the users now as that would need multiple changes in other APIs from which we get the user infromation. How do you suggest we tackle it?