whatisgithub

What is javacpp?

bytedeco/javacpp — explained in plain English

Analysis updated 2026-06-26

4,694JavaAudience · developerComplexity · 4/5Setup · hard

In one sentence

A Java library that lets your Java code call high-performance C++ libraries directly by automatically generating the bridging code, so you can use tools like OpenCV, FFmpeg, and TensorFlow from Java without writing glue code.

Mindmap

mindmap
  root((javacpp))
    What it does
      Java to C++ bridge
      Auto-generates JNI code
      Handles memory management
    Supported Features
      Templates and inheritance
      Operator overloading
      Function pointers
      Shared pointers
    Wrapped Libraries
      OpenCV image processing
      FFmpeg video encoding
      TensorFlow and CUDA
    Tech Stack
      Java
      C++
      Maven and Gradle
      Android
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Use OpenCV image-processing functions from a Java or Android app without writing any C++ glue code.

USE CASE 2

Call TensorFlow or CUDA GPU-computing code directly from a Java application via JavaCPP Presets.

USE CASE 3

Wrap any C++ library for Java by letting JavaCPP auto-generate the JNI connector instead of hand-coding it.

USE CASE 4

Add a high-performance C++ dependency to a Maven or Gradle project with a single dependency declaration.

What is it built with?

JavaC++JNIMavenGradleAndroid

How does it compare?

bytedeco/javacppspring-attic/spring-security-oauth981011512/--
Stars4,6944,6984,687
LanguageJavaJavaJava
Setup difficultyhardmoderatehard
Complexity4/53/55/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · hard Time to first run · 1h+

Requires a C++ compiler installed on the same machine, as some native compilation happens locally when building the bindings.

So what is it?

JavaCPP is a Java library that lets Java programs call code written in C++. Java and C++ are two different programming languages, and normally they cannot talk to each other directly. JavaCPP acts as a bridge, translating calls between them so that a Java application can use a C++ library as if it were a native part of the Java ecosystem. The need for this kind of bridge arises frequently in areas like computer vision, machine learning, and multimedia processing, where many high-performance libraries are written in C++. JavaCPP has already been used to wrap well-known C++ libraries including OpenCV (image processing), FFmpeg (video encoding), TensorFlow, and CUDA (GPU computing), among others. Those wrapped versions are available as a companion project called JavaCPP Presets. Under the hood, JavaCPP uses a standard Java mechanism called JNI (Java Native Interface) to communicate with native code. What JavaCPP adds on top of JNI is automatic generation of the connector code, so you do not have to write the tedious glue yourself. It handles a wide range of C++ features that are difficult to bridge, including templates, operator overloading, function pointers, virtual functions, inheritance, and memory management through shared pointers. To use JavaCPP in a project, you add it as a dependency through Maven, Gradle, or another standard Java build tool. It requires a Java installation (version 8 or newer) and a C++ compiler on the same machine, because some compilation happens locally when building the native bindings. It works on Linux, macOS, and Windows, and also supports Android. The project is available on Maven Central, which means it can be added to any Java project with a single dependency declaration. Documentation and examples are provided through a wiki, and community support is available via a mailing list and GitHub Discussions.

Copy-paste prompts

Prompt 1
Using JavaCPP Presets for OpenCV, write Java code that reads an image file, resizes it, and saves the result.
Prompt 2
How do I add JavaCPP and the OpenCV preset to my Maven pom.xml and run a basic image processing operation?
Prompt 3
Show me how to wrap a custom C++ function for use in Java using JavaCPP annotations.
Prompt 4
Set up JavaCPP in an Android project and use FFmpeg to extract a single frame from a video file.

Frequently asked questions

What is javacpp?

A Java library that lets your Java code call high-performance C++ libraries directly by automatically generating the bridging code, so you can use tools like OpenCV, FFmpeg, and TensorFlow from Java without writing glue code.

What language is javacpp written in?

Mainly Java. The stack also includes Java, C++, JNI.

How hard is javacpp to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is javacpp for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.