Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
J

javacpp-presets

> 包管理
Open source

The missing Java distribution of native C++ libraries

2.8K stars0 likes0 views
WebsiteGitHub

About

The missing Java distribution of native C++ libraries

JavaCPP Presets


Build status for all platforms (Android, iOS, Linux, Mac OS X, Windows): Commercial support and paid services for custom presets:

Introduction

The JavaCPP Presets modules contain Java configuration and interface classes for widely used C/C++ libraries. The configuration files in the org.bytedeco.<moduleName>.presets packages are used by the Parser to create from C/C++ header files the Java interface files targeting the org.bytedeco.<moduleName> packages, which in turn are used by the Generator and the native C++ compiler to produce the required JNI libraries. Moreover, helper classes make their functionality easier to use on the Java platform, including Android.

For orientation purposes, the documentation of this repository can be thought of as being split into 2 levels:

  1. The directory where this parent README.md document is located belongs to the upper level, the javacpp-presets module itself, and
  2. The subdirectories in it are the actual child modules, with their README.md files, presets, and packages, as the lower level.

This parent README.md file contains general information applicable to all modules to solve issues concerning downloads, common requirements, installation procedures, and build instructions. The respective README.md files in each subdirectory contain extra information, links, and notes concerning API documentation, specific requirements, dependencies for pom.xml files, and sample usage code, for the presets and packages of each module. Please be aware that not all of the presets have the same level of maturity, and the style and layout may also differ from one to another since they are based on the APIs of third-party libraries.

Please refer to the wiki page for more information about how to create new presets. Since additional documentation is currently lacking, please also feel free to ask questions on the mailing list or the discussion forum.

Downloads

JAR files containing binaries for all child modules and builds for all supported platforms (Android, iOS, Linux, Mac OS X, and Windows) can be obtained from the Maven Central Repository. Archives containing these JAR files are also available as releases.

To install manually the JAR files, follow the instructions in the Manual Installation section below.

We can also have everything downloaded and installed automatically with:

  • Maven (inside the pom.xml file)
xml
  <dependency>
    <groupId>org.bytedeco</groupId>
    <artifactId>${moduleName}-platform</artifactId>
    <version>${moduleVersion}-1.5.14</version>
  </dependency>
  • Gradle (inside the build.gradle.kts or build.gradle file)
groovy
  dependencies {
    implementation("org.bytedeco:$moduleName-platform:$moduleVersion-1.5.14")
  }
  • Leiningen (inside the project.clj file)
clojure
  :dependencies [
    [~(symbol (str "org.bytedeco/" moduleName "-platform")) ~(str moduleVersion "-1.5.14")]
  ]
  • sbt (inside the build.sbt file)
scala
  libraryDependencies += "org.bytedeco" % moduleName + "-platform" % moduleVersion + "-1.5.14"

where the moduleName and moduleVersion variables correspond to the desired module. This downloads binaries for all platforms, but to get binaries for only one platform we can set the javacpp.platform system property (via the -D command line option) to something like android-arm, linux-x86_64, macosx-x86_64, windows-x86_64, etc. We can also specify more than one platform, see the examples at Reducing the Number of Dependencies. Another option available to Gradle users is Gradle JavaCPP, and similarly for Scala users there is SBT-JavaCPP.

Required Software

To use the JavaCPP Presets, you will need to download and install the following software:

  • An implementation of Java SE 8 or newer:
    • OpenJDK http://openjdk.java.net/install/ or
    • Oracle JDK http://www.oracle.com/technetwork/java/javase/downloads/ or
    • IBM JDK http://www.ibm.com/developerworks/java/jdk/ or
    • Microsoft JDK https://www.microsoft.com/openjdk etc

Further, in the case of Android, the JavaCPP Presets also rely on:

  • Android SDK API 24 or newer http://developer.android.com/sdk/

Manual Installation

Simply put all the desired JAR files (opencv*.jar, ffmpeg*.jar, etc.), in addition to javacpp.jar, somewhere in your class path. The JAR files available as pre-built artifacts are meant to be used with JavaCPP. The binaries for Linux are built with Ubuntu, so they should work on most distributions currently in use. Here are some more specific instructions for common cases:

NetBeans (Java SE 8 or newer):

  1. In the Projects window, right-click the Libraries node of your project, and select "Add JAR/Folder...".
  2. Locate the JAR files, select them, and click OK.

Eclipse (Java SE 8 or newer):

  1. Navigate to Project > Properties > Java Build Path > Libraries and click "Add External JARs...".
  2. Locate the JAR files, select them, and click OK.

Visual Studio Code (Java SE 8 or newer):

  1. Navigate to Java Projects > Referenced Libraries, and click +.
  2. Locate the JAR files, select them, and click OK.

IntelliJ IDEA (Android 7.0 or newer):

  1. Follow the instructions on this page: http://developer.android.com/training/basics/firstapp/
  2. Copy all the JAR files into the app/libs subdirectory.
  3. Navigate to File > Project Structure > app > Dependencies, click +, and select "2 File dependency".
  4. Select all the JAR files from the libs subdirectory.

After that, we can access almost transparently the corresponding C/C++ APIs through the interface classes found in the org.bytedeco.<moduleName> packages. Indeed, the Parser translates the code comments from the C/C++ header files into the Java interface files, (almost) ready to be consumed by Javadoc. However, since their translation still leaves to be desired, one may wish to refer to the original documentation pages. For instance, the ones for OpenCV and FFmpeg can be found online at:

  • OpenCV documentation
  • FFmpeg documentation

Build Instructions

If the binary files available above are not enough for your needs, you might need to rebuild them from the source code. To this end, project files on the Java side were created as Maven modules. By default, the Maven build also installs the native libraries on the native C/C++ side with the cppbuild.sh scripts, but they can also be installed by other means.

Additionally, one can find on the wiki page additional information about the recommended build environments for the major platforms.

The Maven modules

The JavaCPP Presets depend on Maven, a powerful build system for Java, so before attempting a build, be sure to install and read up on:

  • Maven 3.x http://maven.apache.org/download.html
  • JavaCPP 1.5.14 https://github.com/bytedeco/javacpp

Each child module in turn relies by default on the included cppbuild.sh scripts, explained below, to install its corresponding native libraries in the cppbuild subdirectory. To use native libraries already installed somewhere else on the system, other installation directories than cppbuild can also be specified either in the pom.xml files or in the .java configuration files. The following versions are supported:

  • OpenCV 4.14.x https://opencv.org/releases/
  • FFmpeg 8.1.x http://ffmpeg.org/download.html
  • FlyCapture 2.13.x https://www.flir.com/products/flycapture-sdk
  • Spinnaker 4.0.x https://www.flir.com/products/spinnaker-sdk
  • libdc1394 2.2.6 http://sourceforge.net/projects/libdc1394/files/
  • libfreenect 0.5.7 https://github.com/OpenKinect/libfreenect
  • libfreenect2 0.2.0 https://github.com/OpenKinect/libfreenect2
  • librealsense 1.12.x https://github.com/IntelRealSense/librealsense
  • librealsense2 2.53.x https://github.com/IntelRealSense/librealsense
  • videoInput 0.200 https://github.com/ofTheo/videoInput/
  • ARToolKitPlus 2.3.1 https://launchpad.net/artoolkitplus
  • Chilitags https://github.com/chili-epfl/chilitags
  • flandmark 1.07 https://github.com/uricamic/flandmark
  • Arrow 6.0.x https://arrow.apache.org/install/
  • HDF5 1.14.x https://www.hdfgroup.org/downloads/
  • Hyperscan 5.4.x https://github.com/intel/hyperscan
  • LZ4 1.9.x https://github.com/lz4/lz4
  • MKL 2026.1.x https://software.intel.com/mkl
  • MKL-DNN 0.21.x https://github.com/oneapi-src/oneDNN
  • DNNL 3.13.x https://github.com/oneapi-src/oneDNN
  • OpenBLAS 0.3.34 http://www.openblas.net/
  • ARPACK-NG 3.9.x https://github.com/opencollab/arpack-ng
  • CMINPACK 1.3.14 https://github.com/devernay/cminpack
  • FFTW 3.3.11 http://www.fftw.org/download.html
  • GSL 2.8 http://www.gnu.org/software/gsl/#downloading
  • CPython 3.14.x https://www.python.org/downloads/
  • NumPy 2.5.x https://github.com/numpy/numpy
  • SciPy 1.18.x https://github.com/scipy/scipy
  • Gym 0.26.x https://github.com/openai/gym
  • LLVM 22.1.x http://llvm.org/releases/download.html
  • libffi 3.7.x https://github.com/libffi/libffi
  • libpostal 1.1 https://github.com/openvenues/libpostal
  • LibRaw 0.21.x https://www.libraw.org/download
  • Leptonica 1.87.x http://www.leptonica.org/download.html
  • Tesseract 5.5.x https://github.com/tesseract-ocr/tesseract
  • Caffe 1.0 https://github.com/BVLC/caffe
  • OpenPose 1.7.0 https://github.com/CMU-Perceptual-Computing-Lab/openpose
  • CUDA 13.3.x https://developer.nvidia.com/cuda-downloads
    • cuDNN 9.25.x https://developer.nvidia.com/cudnn
    • NCCL 2.30.x https://developer.nvidia.com/nccl
    • nvCOMP 5.3.x https://developer.nvidia.com/nvcomp
  • NVIDIA Video Codec SDK 13.1.x https://developer.nvidia.com/nvidia-video-codec-sdk
  • OpenCL 3.1.x https://github.com/KhronosGroup/OpenCL-ICD-Loader
  • MXNet 1.9.x https://github.com/apache/incubator-mxnet
  • PyTorch 2.14.x https://github.com/pytorch/pytorch
  • SentencePiece 0.2.x https://github.com/google/sentencepiece
  • TensorFlow 1.15.x https://github.com/tensorflow/tensorflow
  • TensorFlow Lite 2.21.x https://github.com/tensorflow/tensorflow
  • TensorRT 11.2.x https://developer.nvidia.com/tensorrt
  • Triton Inference Server 2.71.x https://developer.nvidia.com/nvidia-triton-inference-server
  • The Arcade Learning Environment 0.8.x https://github.com/mgbellemare/Arcade-Learning-Environment
  • DepthAI 2.24.x https://github.com/luxonis/depthai-core
  • ONNX 1.22.x https://github.com/onnx/onnx
  • nGraph 0.26.0 https://github.com/NervanaSystems/ngraph
  • OpenVINO 2026.2.x https://github.com/openvinotoolkit/openvino
  • ONNX Runtime 1.28.x https://github.com/microsoft/onnxruntime
  • TVM 0.18.x https://github.com/apache/tvm
  • Bullet Physics SDK 3.25 https://pybullet.org
  • LiquidFun http://google.github.io/liquidfun/
  • Qt 5.15.x https://download.qt.io/archive/qt/
  • Mono/Skia 2.88.x https://github.com/mono/skia
  • cpu_features 0.7.0 https://github.com/google/cpu_features
  • ModSecurity 3.0.x https://github.com/SpiderLabs/ModSecurity
  • System APIs of the build environments:
    • L

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaandroidjavajavacpp-presetsmaven

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category包管理
PricingOpen source

> Related tools

N
npm
Node.js 默认包管理器
P
pnpm
高效节省磁盘的 Node 包管理器
I
is-gif
Check if a Buffer/Uint8Array is a GIF image