views:

152

answers:

5

Is it possible to a Java class to implement a C++ interface (interface meaning a full abstract class)? Where can I read more about?

+1  A: 

Not in the general sense, no. C++ classes do not exist in the compiled binary the vast majority of the time.

Billy ONeal
A: 

Java class can implement Java interface. Java/C++ communication is done using JNI.

Ha
+2  A: 

Yes, you have to use JNI.

Here's a tutorial from Sun / Oracle

Tom
+2  A: 

Not directly, no. However, you can create a C++ implementation of that interface that simply delegates to a Java implementation via JNI. See the JNI Specification for more details.

Anon
A: 

Besides JNI there's another technology named JNA. It seems to be simpler (no need to create C/C++ stub code).

archer