The Java Version Almanac
Feedback on this page?

Unix Domain Sockets

Since Java 16 finally Unix domain local interprocess communication is supported.

Since Java 16

import static; import static java.nio.charset.StandardCharsets.UTF_8; import; import; import java.nio.ByteBuffer; import java.nio.channels.Channels; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.nio.file.Files; public class UnixDomainSockets { public static void main(String... args) throws IOException { // Create a server socket on a temporary file name var server =; server.bind(null); var address = (UnixDomainSocketAddress) server.getLocalAddress(); System.out.println("Listening on " + address); // Connect client and send a message try (var client = { client.connect(address); client.write(ByteBuffer.wrap("Hello Socket!".getBytes(UTF_8))); } // Accept connection and read the message from it try (var input = Channels.newInputStream(server.accept())) { input.transferTo(System.out); } // Cleanup server.close(); Files.delete(address.getPath()); } }

This snippet at GitHub