Java bindings for Box3D across desktop, web, and Android.
jBox3D provides a platform-neutral Java API, native runtimes for JNI, Java FFM, TeaVM C, and WebAssembly, plus integrations for libGDX and libFDX. The bindings are generated from a WebIDL contract and stay close to the upstream Box3D API.
Online samples: xpenatan.github.io/jBox3D | 2D companion project: jBox2D
Artifacts use the Maven group com.github.xpenatan.jBox3D. A project normally depends on the core API, one platform runtime, and optionally a rendering integration.
repositories {
mavenCentral()
maven {
url = uri("https://central.sonatype.com/repository/maven-snapshots/")
content {
includeGroup("com.github.xpenatan.jBox3D")
}
}
}
val jbox3dVersion = "-SNAPSHOT"
dependencies {
implementation("com.github.xpenatan.jBox3D:core:$jbox3dVersion")
runtimeOnly("com.github.xpenatan.jBox3D:desktop-jni:$jbox3dVersion")
implementation("com.github.xpenatan.jBox3D:gdx-gl:$jbox3dVersion")
}For a release, use its published version and remove the snapshot repository when it is no longer needed.
| Artifact | Purpose |
|---|---|
core |
Platform-neutral Box3D API. |
shared-jni, desktop-jni, android-jni |
JNI bindings and platform runtimes. |
desktop-ffm |
Java 25 FFM desktop runtime. |
shared-c, desktop-c, android-c |
TeaVM C bindings and platform runtimes. |
web-wasm |
TeaVM web bindings and Emscripten side module. |
gdx-gl, gdx-wgpu, fdx |
Rendering and math integrations. |
The generated API stays close to Box3D semantics while adapting native handles and structs for Java. Integration converters write into caller-owned output objects, avoiding temporary allocations in render loops:
GdxBox3DConverter.toGdx(box3dVector, reusableGdxVector);
GdxBox3DConverter.toBox3D(gdxVector, reusableBox3dVector);
FdxBox3DConverter.toFdx(box3dVector, reusableFdxVector);
FdxBox3DConverter.toBox3D(fdxVector, reusableBox3dVector);The sample suite includes libGDX OpenGL and WebGPU renderers, plus libFDX OpenGL, WebGPU, and Vulkan renderers where supported.
Box3D and its Java API are still evolving. Binding generation, native packaging, integrations, and cross-platform samples are available, but APIs may change between releases.
jBox3D is licensed under the Apache License 2.0. Upstream Box3D is developed by Erin Catto and is licensed under the MIT license.