Java and Kotlin
Java
Drive a real tmux from Java and Kotlin.
io.github.libtmux:libtmux
Install
$ implementation("io.github.libtmux:libtmux:VERSION")Quickstart
ServerConfig config = ServerConfig.builder() .endpoint(ServerEndpoint.socketPath(socket)) .build();
try (Server server = Server.open(config)) { Session session = server.newSession("demo"); Window window = session.newWindow("build"); Pane pane = window.split();
pane.sendLine("echo hello from libtmux");}socket in the code above is a java.nio.file.Path to a real tmux socket — the README's own test fixture supplies one. TmuxEnvironment.current() resolves the socket your own process is already inside, when there is one.
The README's opening example, verbatim — checked by docs-tests, which compiles every README snippet and runs it against a real tmux unless the snippet's own <!-- snippet: compile-only: ... --> marker says why not. This one is marked compile-only: it opens a second client to the suite's own server, which would race it.
API References
Read on
Topics
Deep dives into one subject at a time, in Java: architecture, traversal, options and hooks.
Guides
Task-oriented walkthroughs in Java — install tmux, then the round trip every real program starts from.
Examples
The same concrete tasks worked through in Java, with each snippet checked by the port's own tests.
Concepts
The domain model every port shares — the object hierarchy, transports and filtering.