Developing JNI applications with Eclipse (Combined Java/C++)
Have anyone successfully mana开发者_JS百科ged 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)
http://www.cs.umanitoba.ca/~eclipse/8-JNI.pdf I think this is what you wanted.Maybe a little old.
This really sounds like a job for a build system, like ant
. Simply configure your Java project to use the ant builder. You would still get the benefits of language specific support for your C++ and Java projects, and, one click build of the project.
I'm using the ant cpptasks for realizing a JNI project with Eclipse only on Linux and Windows. It was some work to get it running with the MSVC (Windows) and the GNU C++ compiler (getting all compiler and linker flags properly since has been done with Visual Studio Magic before) but it was really worth it.
For generating the C++ Header with javah and all the other Tasks you mentioned Ant will probably be the tool of choice, too.
精彩评论