I need to access some remote files with a java program. The idea was not to use system calls. Now I am trying out java ssh implementations.
So j2ssh was the first I tested. I quit testing more. Because
-it’s nearly undocumented, the few examples are rather complex and since none matches my needs I would have to derive functionality from there
-there is a tutorial online but this covers only the same stuff as the examples
-the forum they have helped me find that the problem I had was not mine but theirs, thx
-I had to write my own javadoc task into their build-file only to find out that just most classes were still undocumented, so the javadoc was of little use
-the current distribution 0.2.6 has an error, it is missing some private key extensions that can be obtained separately via sourceforge
-the only source available is 0.2.5 to which I had to add the task generating the jar-file
-the next that happened was that there was no default public key, it seemed I needed to add some configuration files, since that’s also an undocumented feature I quit testing j2ssh
Next I moved to jsch by jcraft. So far here’s what I found:
-there is a javadoc task, but there are no comments in the code it seems
-there are some more examples, but they are way to complex to understand things, because they are using java.swing stuff in there.
-I experimented with setting some properties like the known_hosts file
-again it is not documented which values have to be set in order to connect and what the values must be, I even started looking into the code, but there is a lot of really basic stuff there I didn’t want to take the time to understand and again: no comments in the code.
– I kept getting an “Unknown Host” or “Hostkey rejected” type of exception but they have only one type of exception with different messages and that class is not documented like most.
– I quit.
Before I started with the other tools I already rejected the Mindterm ssh implementation because of the weird license they have. I just cannot use anything that is not free.
Now after testing the jcraft implementation I tried this:
Runtime runtime = Runtime.getRuntime();
runtime.exec("scp login@host:file.txt /home/me");
Oh and it just worked. So for now that is my solution, it takes 2 seconds to implement instead of one and a half days to arrive at undocumented errors!!!