Have anyone successfully managed to setup a combined Java/C++ project for Eclipse?
What I am trying to do is quite simple;
1) Compile my Java sources
2) Run Javah to create the JNI interface
3) Compile all the C/C++ sources
4) Link native shared library + package the JAR
Hints or even real projects which work are much welcome.
(Eclipse 3.5)
The first thing you do is declare a native function inside your Java class with appropriate Request and Responses. Next, inside your Java class, you load a System library (a . so file or a . dll file) that includes the implementation of this native function in C++.
Java Native Access (JNA) is a community-developed library that provides Java programs easy access to native shared libraries without using the Java Native Interface (JNI). JNA's design aims to provide native access in a natural way with a minimum of effort. Unlike JNI, no boilerplate or generated glue code is required.
typedef jobject jclass; In C++, JNI introduces a set of dummy classes to enforce the subtyping relationship. For example: class _jobject {}; class _jclass : public _jobject {}; ...
http://www.cs.umanitoba.ca/~eclipse/8-JNI.pdf I think this is what you wanted.Maybe a little old.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With