freshcrate
Skin:/
Home > Frameworks > onnxruntime-java

onnxruntime-java

A type-safe, lightweight, modern, and performant binding Java binding of Microsoft's ONNX Runtime

Why this rank:Recent releaseStrong adoptionHealthy release cadence

Description

A type-safe, lightweight, modern, and performant binding Java binding of Microsoft's ONNX Runtime

README

onnxruntime-java

by @yuzawa-san

GitHub branch status codecov

This is an performant and modern Java binding to Microsoft's ONNX Runtime which uses Java's new Foreign Function & Memory API (a.k.a. Project Panama).

This project's goals are to provide a type-safe, lightweight, and performant binding which abstracts a lot of the native and C API intricacies away behind a Java-friendly interface. This is loosely coupled to the upstream project and built off of the public (and stable) C API.

The minimum supported Java version is 23, since the FFI API was first stabilized in that version. There are other fine bindings which use JNI and are capable of supporting earlier Java versions.

Usage

This project is released to Maven Central and can be used in your project.

Artifacts

The library is currently built for Linux, Windows, MacOS and for arm64 and x86_64. These were chosen since the upstream projects publishes artifacts for these enviroments. Here are the artifacts published listed below. Snapshot releases are periodically released for testing and experimentation.

onnxruntime

maven javadoc Maven metadata URL

The binding with no native libraries. For use as a implementation dependency.

The native library (from Microsoft) will need to be provided at runtime using one of the next two artifacts. Alternatively, the Java library path (java.library.path) will be used if neither of those artifacts is provided. This allows users to "bring their own" shared library. The API has a validation to make sure the shared library is minor version compatible with this library.

onnxruntime-cpu

maven

A collection of native libraries with CPU support for a several common OS/architecture combinations. For use as an optional runtime dependency. Include one of the OS/Architecture classifiers like linux-x86_64 to provide specific support.

onnxruntime-gpu

maven

A collection of native libraries with GPU (CUDA) support for a several common OS/architecture combinations. For use as an optional runtime dependency. Include one of the OS/Architecture classifiers like linux-x86_64 to provide specific support.

In your library

There is an example library in the onnxruntime-sample-library directory. The library should use the onnxruntime as a implementation dependency. This puts the burden of providing a native library on your end user.

In your application

There is an example application in the onnxruntime-sample-application directory. The library should use the onnxruntime as a implementation dependency. The application needs to have acccess to the native library. You have the option providing it via a runtime dependency using either a classifier variant from onnxruntime-cpu or onnxruntime-gpu. Otherwise, the Java library path will be used to load the native library.

The example application can be ran:

./gradlew onnxruntime-sample-application:run

JVM Arguments

Since this uses a native library, this will require the runtime to have the --enable-native-access JVM option, likely --enable-native-access=ALL-UNNAMED.

Execution Providers

Only those which are exposed in the C API are supported. If you wish to use another execution provider which is present in the C API, but not in any of the artifacts from the upstream project, you can choose to bring your own onnxruntime shared library to link against.

Versioning

The version of the upstream project used will be reflected in the release notes. Semantic versioning is used. Major version will be bumped when this API or the underlying C API has backward incompatible changes. Upstream major version changes will typically be major version changes here. Minor version will be bumped for smaller, but compatible changes. Upstream minor version changes will typically be minor version changes here.

The minimum native library version (e.g. onnxruntime-cpu) for the onnxruntime artifact will be stated in the release notes.

Release History

VersionChangesUrgencyDate
v1.26.0-1<!-- Release notes generated using configuration in .github/release.yml at v1.26.0-1 --> ## What's Changed ### Upstream Upgrades * Set onnxruntime baseline to v1.26.0 by @yuzawa-san in https://github.com/yuzawa-san/onnxruntime-java/pull/408 ### Dependency Upgrades * Bump com.microsoft.onnxruntime:onnxruntime from 1.25.0 to 1.25.1 by @dependabot[bot] in https://github.com/yuzawa-san/onnxruntime-java/pull/407 * Bump gradle-wrapper from 9.4.1 to 9.5.0 by @dependabot[bot] in https://github.cHigh5/25/2026
v1.25.1-1> [!WARNING] > Prior versions used the `com.jyuzawa:onnxruntime` [Maven coordinates](https://search.maven.org/artifact/com.jyuzawa/onnxruntime) with a bastardized version of semver. Please upgrade to the new `com.jyuzawa:onnxruntime-api` [Maven coordinates](https://central.sonatype.com/artifact/com.jyuzawa/onnxruntime-api). ## New Version Scheme This library's version string will be `${ORT_UPSTREAM_VERSION}-${THIS_REPO_VERSION}`. The first part indicates the minimum upstream native librHigh4/29/2026
v2.1.0<!-- Release notes generated using configuration in .github/release.yml at v2.1.0 --> ## What's Changed ### Required Minimum Version Changes * Upgrade onnxruntime to 1.24.2 by @yuzawa-san in https://github.com/yuzawa-san/onnxruntime-java/pull/377 * Set onnxruntime baseline to v1.24.3 by @yuzawa-san in https://github.com/yuzawa-san/onnxruntime-java/pull/385 ### Dependency Upgrades * Bump com.google.protobuf:protoc from 4.33.4 to 4.33.5 by @dependabot[bot] in https://github.com/yuzawa-san/Medium3/13/2026
v2.0.0Initial release with stable JDK API. ## What's Changed * Bump com.diffplug.spotless from 6.23.3 to 6.24.0 by @dependabot[bot] in https://github.com/yuzawa-san/onnxruntime-java/pull/181 * Bump com.google.protobuf:protoc from 3.25.1 to 3.25.2 by @dependabot[bot] in https://github.com/yuzawa-san/onnxruntime-java/pull/182 * Bump com.google.protobuf:protobuf-java from 3.25.1 to 3.25.2 by @dependabot[bot] in https://github.com/yuzawa-san/onnxruntime-java/pull/183 * Bump mikepenz/gradle-dependenLow1/22/2026
v1.4.0## What's Changed * Bump com.google.protobuf:protobuf-java from 3.24.3 to 3.24.4 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/151 * Bump com.google.protobuf:protoc from 3.24.3 to 3.24.4 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/152 * Bump com.microsoft.onnxruntime:onnxruntime from 1.16.0 to 1.16.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/153 * Bump org.apache.logging.log4j:log4j-core from 2.20.0 to 2.21.0 by @dLow1/10/2024
v1.3.1## What's Changed * do not mmap model files + use RegisterCustomOpsLibrary_V2 by @yuzawa-san in https://github.com/yuzawa-san/onnxruntime-java/pull/149 * Bump com.diffplug.spotless from 6.21.0 to 6.22.0 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/150 **Full Changelog**: https://github.com/yuzawa-san/onnxruntime-java/compare/v1.3.0...v1.3.1Low10/3/2023
v1.3.0ORT v1.16.0 ## What's Changed * Bump com.microsoft.onnxruntime:onnxruntime from 1.15.0 to 1.15.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/124 * Bump com.google.protobuf:protoc from 3.23.2 to 3.23.4 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/127 * Bump com.google.protobuf:protobuf-java from 3.23.2 to 3.23.4 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/128 * Bump com.google.protobuf from 0.9.3 to 0.9.4 by @depeLow9/26/2023
v1.2.0## Main Items * ORT v1.15.0 * New execution providers * Arena config for environments * separate artifact versions. `onnxruntime-cpu` and `onnxruntime-gpu` are versioned with `1.15.0` and published with OS/arch classifiers. Those depend on `onnxruntime` version 1.2.0. ## What's Changed * Bump org.apache.logging.log4j:log4j-jpl from 2.19.0 to 2.20.0 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/93 * Bump me.champeau.jmh from 0.6.8 to 0.7.0 by @dependabot in httpLow6/7/2023
v1.1.0## What's Changed * Bump com.diffplug.spotless from 6.13.0 to 6.14.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/86 * Bump com.microsoft.onnxruntime:onnxruntime from 1.13.1 to 1.14.0 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/87 * Bump com.diffplug.spotless from 6.14.1 to 6.15.0 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/88 * Bump mikepenz/gradle-dependency-submission from 0.8.3 to 0.8.4 by @dependabot in https:/Low2/22/2023
v1.0.0## What's Changed * Bump protobuf-java from 3.21.2 to 3.21.3 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/38 * Bump protoc from 3.21.2 to 3.21.3 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/39 * Bump com.diffplug.spotless from 6.8.0 to 6.9.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/43 * Bump protoc from 3.21.3 to 3.21.5 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/44 * Bump protobuf-java Low1/17/2023
v0.0.5## What's Changed * Bump com.diffplug.spotless from 6.5.2 to 6.6.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/25 * Bump protoc from 3.20.1 to 3.21.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/26 * Bump protobuf-java from 3.20.1 to 3.21.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/27 * Bump com.diffplug.spotless from 6.6.1 to 6.7.2 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/29 * Bump pLow7/22/2022
v0.0.4## What's Changed * Bump protoc from 3.20.0 to 3.20.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/17 * Bump protobuf-java from 3.20.0 to 3.20.1 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/18 * Bump com.diffplug.spotless from 6.4.2 to 6.5.0 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/19 * Bump github/codeql-action from 1 to 2 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/20 * Bump codecov/coLow5/13/2022
v0.0.3## What's Changed * try codeql by @yuzawa-san in https://github.com/yuzawa-san/onnxruntime-java/pull/6 * Bump actions/checkout from 2 to 3 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/5 * Bump actions/cache from 2.1.7 to 3 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/7 * try fixing tar extraction by @yuzawa-san in https://github.com/yuzawa-san/onnxruntime-java/pull/10 * Bump protoc from 3.19.4 to 3.20.0 by @dependabot in https://github.com/yLow4/24/2022
v0.0.2## What's Changed * Add Windows Support + Multi OS CI by @yuzawa-san in https://github.com/yuzawa-san/onnxruntime-java/pull/4 ## New Contributors * @yuzawa-san made their first contribution in https://github.com/yuzawa-san/onnxruntime-java/pull/4 **Full Changelog**: https://github.com/yuzawa-san/onnxruntime-java/compare/v0.0.1...v0.0.2Low3/5/2022
v0.0.1## What's Changed * Initial version * Bump com.diffplug.spotless from 6.2.1 to 6.3.0 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/1 * Bump log4j-jpl from 2.17.1 to 2.17.2 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/2 * Bump log4j-core from 2.17.1 to 2.17.2 by @dependabot in https://github.com/yuzawa-san/onnxruntime-java/pull/3 ## New Contributors * @dependabot made their first contribution in https://github.com/yuzawa-san/onnxruntime-javLow3/5/2022

Dependencies & License Audit

Loading dependencies...

Similar Packages

onnxruntimeONNX Runtime: cross-platform, high performance ML inferencing and training acceleratorv1.26.0
modular-image-classification-frameworkA modular deep learning framework for training and evaluating image classification models on datasets like CIFAR-10 and MNIST. Supports configurable CNN architectures, automated training, and performamain@2026-05-28
cONNXrPure C ONNX runtime with zero dependancies for embedded devices0.0.0
transformersTransformers: the model-definition framework for state-of-the-art machine learning models in text, vision, audio, and multimodal models, for both inference and training.v5.10.1
APTAI Productivity Tool - Free and open source, improve user productivity, and protect privacy and data security. Including but not limited to: built-in local exclusive ChatGPT, DeepSeek, Phi, Qwen and o2.9.16.0

More in Frameworks

langchainThe agent engineering platform
deer-flowAn open-source long-horizon SuperAgent harness that researches, codes, and creates. With the help of sandboxes, memories, tools, skill, subagents and message gateway, it handles different levels of ta
tqdmFast, Extensible Progress Meter
simBuild, deploy, and orchestrate AI agents. Sim is the central intelligence layer for your AI workforce.