In ruby I have:
PTY.spawn("/usr/bin/lxc-monitor -n .+") do |i, o, pid| # ... end
How do this in scala/java?
Try JPty or pty4j. These are implementations of pty for Java using JNA.