ointment
ointment

Reputation: 173

Developing JNI applications with Eclipse (Combined Java/C++)

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)

Upvotes: 17

Views: 27694

Answers (3)

dape
dape

Reputation: 565

http://www.cs.umanitoba.ca/~eclipse/8-JNI.pdf I think this is what you wanted.Maybe a little old.

Upvotes: 7

Daff
Daff

Reputation: 44215

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.

Upvotes: 1

alphazero
alphazero

Reputation: 27234

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.

Upvotes: 5

Related Questions