Home - loicoudot/java4cpp-core GitHub Wiki

java4cpp

With java4cpp, you can leverage the power of Java everywhere you want in your C++ native project without effort.

It lets you call seamlessly Java classes directly in C++ project. For example:

void method()
{
   // Create a new java.util.Properties instance
   java::util::Properties properties;
   // Adds a new value inside
   properties.setProperty("key", "value");
   ...
}

The goal of java4cpp is to automatically write JNI source code by introspecting Java classes to create C++ proxies that reflect the original structures. It is also fully customizable and you can add your own transformations rules between Java and C++ to achieve almost all possible interoperability.

Key features:

  • Automatic JNI optimized source code generator
  • Very low overhead
  • Fully customizable
  • Manage JVM inside your native process
  • Use real Java classes (no source code translation)
  • Multi-Threaded
  • Resource leak management
  • Class loading management

Table of content

  • Tutorial : get ready in 5 minutes and discover java4cpp immediately.
  • Generation : How to generate proxies with Java4cpp.
  • Mappings : How to controls mappings between Java/C++ classes hierarchies and contents.
  • Templates : Lists the available templates for types mappings between Java and C++.
  • Customization : How to customize JNI generation and type mappings.