Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Java class implement a C++ interface

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

like image 361
The Student Avatar asked Dec 07 '25 15:12

The Student


2 Answers

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.

like image 192
Anon Avatar answered Dec 10 '25 05:12

Anon


Yes, you have to use JNI.

Here's a tutorial from Sun / Oracle

like image 45
Tom Avatar answered Dec 10 '25 05:12

Tom