Here is what I want to do in java:

  • Open an ssh session ( remote or local).
  • Send commands ( this is just an example):
  • cleartool lsview
  • cleartool setview
  • cleartool catcs

For ssh connection there seems to be a number of ssh libraries (I am only lookin' for open source). But the problem seems to be how we can send commands and check the execution state for each one before sending another one. I have seen solutions where they open a shell and then sends each command and checks if the shell prompt returns. Problem I have faced is that most servers have different prompts (and we do not have control of it) and sometimes the prompt changes (scripts do sourcing).

Are there any solutions out there on how to solve this problem?

share|improve this question
What have you tried? Show us your code! – MrSmith42 Feb 3 at 20:59
possible duplicate of Send ssh command from Java code – Pshemo Feb 3 at 21:23

closed as not constructive by m0skit0, MrSmith42, Pshemo, Sylvain Defresne, Beerlington Feb 3 at 23:21

As it currently stands, this question is not a good fit for our Q&A; format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

1 Answer

I've had a lot of success using jsch. Look into it and let me know if it works for you!

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.