Yes I guess so to, but I would have expected another error message than this or simply none at all, or I could have accepted a " Hey Stupido, it's allready loaded" :)
I actually also tried to just initiate the jsch but got an error also then, that it couldn't find it. Will soon be at homeso I will remote connect to the office and try that once again. On Monday, March 14, 2011, Matthew Woodward <[email protected]> wrote: > I could be wrong (have to test after lunch) but bet you don't need import. If > it's in the right lib directory you can just do createobject on the java > class if you want to do things in cfml. > I'll try to mess with it this afternoon. > On Mar 14, 2011 1:34 PM, "Mats Stromberg" <[email protected]> wrote:> > That's worth to look at if it's allready in there... Still it doesn't >> explain how I can mess up such small template. >> At the moment it's nothing more than >> >> <cfscript language"java"> >> import com.jcraft.jsch.*; >> >> </cfscript> >> >> Took out all of the rest of the code just to test. >> I should say that I'm using the nightly build 14.03.2011 >> >> /Mats/ >> >> On Monday, March 14, 2011, denstar <[email protected]> wrote: >>> Don't we already use VFS? I could be mistaken (I thought I saw it in >>> there), but theoretically, something like this would work: >>> >>> http://commons.apache.org/vfs/filesystems.html#SFTP >>> >>> Example code for copying a file: >>> >>> public static void copyRemoteFile(String host, String user, >>> String password, String remotePath, String localPath) throws >>> IOException { >>> // we first set strict key checking off >>> FileSystemOptions fsOptions = new FileSystemOptions(); >>> SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking( >>> fsOptions, "no"); >>> // now we create a new filesystem manager >>> DefaultFileSystemManager fsManager = (DefaultFileSystemManager) VFS >>> .getManager(); >>> // the url is of form sftp://user:pass@host/remotepath/ >>> String uri = "sftp://" + user + ":" + password + "@" + host >>> + "/" + remotePath; >>> // get file object representing the local file >>> FileObject fo = fsManager.resolveFile(uri, fsOptions); >>> // open input stream from the remote file >>> BufferedInputStream is = new BufferedInputStream(fo.getContent() >>> .getInputStream()); >>> // open output stream to local file >>> OutputStream os = new BufferedOutputStream(new FileOutputStream( >>> localPath)); >>> int c; >>> // do copying >>> while ((c = is.read()) != -1) { >>> os.write(c); >>> } >>> os.close(); >>> is.close(); >>> // close the file object >>> fo.close(); >>> // NOTE: if you close the file system manager, you won't be able to >>> // use VFS again in the same VM. If you wish to copy multiple files, >>> // make the fsManager static, initialize it once, and close just >>> // before exiting the process. >>> fsManager.close(); >>> System.out.println("Finished copying the file"); >>> } >>> >>> I'm not sure how cffile is set up (id est, using VFS?), but I bet we >>> could leverage some existing infrastructure somewhere... >>> >>> :Den >>> >>> -- >>> Love is something far more than desire for sexual intercourse; it is >>> the principal means of escape from the loneliness which afflicts most >>> men and women throughout the greater part of their lives. >>> Bertrand Russell >>> >>> On Mon, Mar 14, 2011 at 12:58 PM, Mats Stromberg wrote: >>>> I'm just testing the Jcraft jsch library but failing on the first line :) >>>> >>>> import com.jcraft.jsch.*; >>>> >>>> Package com.jcraft.jsch does not exists. >>>> >>>> I do test this on a Jetty installationand I put the jsch-0.1.44.jar in >>>> the wepapps/openbd/WEB-INF/ib folder >>>> >>>> I suppose this is the correct place for an add-on .jar ? or am I >>>> missing it again :) >>>> >>>> /Mats/ >>> >>> -- >>> official tag/function reference: http://openbd.org/manual/ >>> mailing list - http://groups.google.com/group/openbd?hl=en >>> >> >> -- >> official tag/function reference: http://openbd.org/manual/ >> mailing list - http://groups.google.com/group/openbd?hl=en > > > > > -- > official tag/function reference: http://openbd.org/manual/ > mailing list - http://groups.google.com/group/openbd?hl=en > -- official tag/function reference: http://openbd.org/manual/ mailing list - http://groups.google.com/group/openbd?hl=en
