no such file in JSch on android -
im trying upload file service. im doing this:
jsch ssh = new jsch(); java.util.properties config = new java.util.properties(); config.put("stricthostkeychecking", "no"); session = ssh.getsession("****", "*myip*"); session.setpassword("*******"); session.setconfig(config); session.connect(); channel = session.openchannel("sftp"); channel.connect(); channelsftp sftp = (channelsftp) channel; sftp.put(f + "/" + file, " /var/www/webimages/client/88/"); } catch (jschexception e) { e.printstacktrace(); } catch (sftpexception e) { e.printstacktrace(); } { if (channel != null) { channel.disconnect(); } if (session != null) { session.disconnect(); } }
this script im trying use. image file found this:
final string pathtowatch = android.os.environment.getexternalstoragedirectory().tostring() + "/dcim/camera/"; toast.maketext(this, "my service started , trying watch " + pathtowatch, toast.length_long).show(); observer = new fileobserver(pathtowatch) { // set file observer watch directory on sd card @override public void onevent(int event, string file) { if (event == fileobserver.create && !file.equals(".probe")) { log.d(tag, "file created [" + pathtowatch + file + "]"); string inputfilename =environment.getexternalstoragedirectory().getabsolutepath()+"/dcim/camera/"; file f = new file(inputfilename);
f in case: /storage/emulated/0/dcim/camera/img_20150512_124943.jpg
when trying upload error log:
2: no such file 05-12 12:49:45.311 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ com.jcraft.jsch.channelsftp.throwstatuserror(channelsftp.java:2846) 05-12 12:49:45.311 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ com.jcraft.jsch.channelsftp._put(channelsftp.java:594) 05-12 12:49:45.311 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ com.jcraft.jsch.channelsftp.put(channelsftp.java:475) 05-12 12:49:45.311 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ com.jcraft.jsch.channelsftp.put(channelsftp.java:365) 05-12 12:49:45.311 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ com.geniusgentlemen.support_classes.service.backgroundspeebee$1.onevent(backgroundspeebee.java:82) 05-12 12:49:45.311 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ android.os.fileobserver$observerthread.onevent(fileobserver.java:122) 05-12 12:49:45.311 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ android.os.fileobserver$observerthread.observe(native method) 05-12 12:49:45.312 5070-5454/com.geniusgentlemen.gp_android_app w/system.err﹕ @ android.os.fileobserver$observerthread.run(fileobserver.java:85)
what doing wrong have read , write acces in manifest.
the error no such file
misleading - guess it's not source file, destination directory.
you providing jsch destination of <space>/var/www/webimages/client/88/"
- try trim it.
the nice thing open source it's open source: can take @ real line of code exception thrown. (a word of warning: i'm not sure if want that...) both error code , message seem read buffer, it's pretty clear error not coming device, server.
looking @ beginning of class, there a constant error code 2
defined: ssh_fx_no_such_file
.
Comments
Post a Comment