This project is in early development stage! Expect bugs and issues.
Metal4J provides pure Java bindings for Apple’s Metal API, built on top of the Foreign Function & Memory (FFM) API introduced in Java 22 and stabilized in Java 25. It enables GPU programming on macOS directly from Java.
- Implemented entirely in Java, no JNI dependencies
- Uses the stable Foreign Function & Memory API (Java 25). No JNI
- Wrappers for key Metal objects:
MTLDevice
,MTLBuffer
,MTLCommandQueue
,MTLLibrary
,MTLFunction
,MTLPipeline
,MTLCommandBuffer
,MTLEncoder
- Designed to be as close as possible to native Metal
- macOS 13 or newer (Metal supported natively)
- Java 25 or later
- Gradle or Maven build tool
- Device handling
- Command queues
- Buffers
- Multiple device integration
- Pre-compiled kernel support
Contributions, issues, and pull requests are welcome. Please open an issue to discuss major changes before submitting a PR.
Metal4J is licensed under the Apache License, Version 2.0.