views:

1327

answers:

3

Hello.

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)

+1  A: 

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.

Thanks.I'll take a look at this.
ointment
A: 

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.

Daff
A: 

ointment, I have been looking for an example on how to make a JNI program in eclipse and be able to build it successfully for a few days now without finding one, please let me know if you find something...I am trying to do the exact same thing. Thank you much.

Flint