how to hook into system level expect with Java?

前端 未结 3 481
无人共我
无人共我 2021-01-26 00:20

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

相关标签:
3条回答
  • 2021-01-26 01:06

    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.

    0 讨论(0)
  • 2021-01-26 01:21

    As with my knowledge Swig would help you better in hooking up the the two languages. Let me know in case i was wrong

    0 讨论(0)
  • 2021-01-26 01:23

    I have created yet another Java expect library ExpectIt (not listed in Wikipedia) which implements interact loop. Have a look at this example.

    0 讨论(0)
提交回复
热议问题