All Projects → remram44 → java-cpp-example

remram44 / java-cpp-example

Licence: other
Example of using C++ classes from Java. Showcases SWIG, JNA and JNI

Programming Languages

CMake
9771 projects
C++
36643 projects - #6 most used programming language
java
68154 projects - #9 most used programming language
SWIG
194 projects

Projects that are alternatives of or similar to java-cpp-example

Flapigen Rs
Tool for connecting programs or libraries written in Rust with other languages
Stars: ✭ 473 (+250.37%)
Mutual labels:  swig, jni
go-snowboy
Go wrapper for Kitt-AI's snowboy audio detection library.
Stars: ✭ 40 (-70.37%)
Mutual labels:  swig
Cppsharp
Tools and libraries to glue C/C++ APIs to high-level languages
Stars: ✭ 2,221 (+1545.19%)
Mutual labels:  swig
Jxnet
Jxnet is a Java library for capturing and sending custom network packet buffers with no copies. Jxnet wraps a native packet capture library (libpcap/winpcap/npcap) via JNI (Java Native Interface).
Stars: ✭ 26 (-80.74%)
Mutual labels:  jni
Python Gphoto2
Python interface to libgphoto2
Stars: ✭ 229 (+69.63%)
Mutual labels:  swig
ForTrilinos
ForTrilinos provides portable object-oriented Fortran interfaces to Trilinos C++ packages.
Stars: ✭ 24 (-82.22%)
Mutual labels:  swig
Libsodium Jni
(Android) Networking and Cryptography Library (NaCL) JNI binding. JNI is utilized for fastest access to native code. Accessible either in Android or Java application. Uses SWIG to generate Java JNI bindings. SWIG definitions are extensible to other languages.
Stars: ✭ 157 (+16.3%)
Mutual labels:  swig
wgpu-mc
Rust-based replacement for the default Minecraft renderer
Stars: ✭ 254 (+88.15%)
Mutual labels:  jni
clojure-rust-graalvm
An example of Clojure program calling a Rust library, all combined into one executable using GraalVM.
Stars: ✭ 113 (-16.3%)
Mutual labels:  jni
Oshi
Native Operating System and Hardware Information
Stars: ✭ 2,876 (+2030.37%)
Mutual labels:  jna
Java-Memory-Manipulation
User friendly, Garbage-free, and cross-platform process, module and memory interfacing via the power of Java
Stars: ✭ 51 (-62.22%)
Mutual labels:  jna
Gdcm
Grassroots DICOM read-only mirror. Only for Pull Request. Please report bug at http://sf.net/p/gdcm
Stars: ✭ 240 (+77.78%)
Mutual labels:  swig
pyaer
Low-level Python APIs for Accessing Neuromorphic Devices.
Stars: ✭ 20 (-85.19%)
Mutual labels:  swig
Quantlib Swig
QuantLib wrappers to other languages
Stars: ✭ 176 (+30.37%)
Mutual labels:  swig
RemoteAssistance-JAVA
RemoteControl like TeamViewer(JAVA)
Stars: ✭ 28 (-79.26%)
Mutual labels:  jna
Pymupdf Debian
Packaging of pymupdf for Debian
Stars: ✭ 171 (+26.67%)
Mutual labels:  swig
Simplified-JNA
Multi-threaded JNA hooks and simplified library access to window/key/mouse functions.
Stars: ✭ 30 (-77.78%)
Mutual labels:  jna
swig-srilm
SWIG Wrapper for the SRILM toolkit
Stars: ✭ 33 (-75.56%)
Mutual labels:  swig
monero-java
A Java library for using Monero
Stars: ✭ 76 (-43.7%)
Mutual labels:  jni
Android
Swift library for Android
Stars: ✭ 48 (-64.44%)
Mutual labels:  jni

Say Thanks!

Example of using C++ code from Java

This repository contains three separate examples of calling a simple C++ library from Java code.

The example library doesn't do anything but contains a class, MyClass, forcing us to support C++ (and not just plain C).

CMake is used to build this, since locating the dependencies got outside the range of my make-fu. The project is supposed to be portable to all major platforms.

Three different wrappers are used, documented below. Each one achieves the same goal, which is using this C++ class from Java code.

SWIG

This needs the SWIG tool: http://www.swig.org/

SWIG parses the C++ header file and generates both the C++ JNI code and the Java native and helper classes.

JNA

JNA allows Java code to use C dynamic libraries directly. Because our library is in fact C++, a small wrapper is included that wraps it as C code.

You will need the JNA jar to run this: https://github.com/java-native-access/jna

JNI

This examples uses JNI directly, without auto-generation. The MyClass class in Java code just declares its methods as being "native", they are provided by the dynamic library.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].