See also a better question, more specific, on this topic.
I\'ve just discovered expect, a tcl based scripting language for automating, among other things, telnet connect
What mechanisms are available to either hook into expect with Java, or into Java with expect?
None really. The problem is that expect does some really complicated low-level things to manage pseudo-terminals and that uses OS interfaces that the JRE doesn't expose. (It's even more tricky if you're on Windows, where it uses the system debug API.) You'd have to go to doing nasty stuff with native code.
The easy route is to run expect as a subprocess via ProcessBuilder
.
As with my knowledge Swig
would help you better in hooking up the the two languages. Let me know in case i was wrong
I have created yet another Java expect library ExpectIt (not listed in Wikipedia) which implements interact loop. Have a look at this example.