We have a java library (.JAR) that we are consuming in C++ application through JNI, so we are able to call Java class methods from C++. However, we would also like to catch exceptions thrown by the Java methods into our C++ code that is calling the Java methods. How to do this using JNI?
The other challenge we have is we would also like to receive callbacks from Java library into C++. Specifically what we would like to do is - There is an interface in Java, meaning it only has method definitions, no implementation. Now, we want to implement this interface of Java in C++ through JNI, so the methods of the interface will be implemented in C++ code and then the object of the C++ class that implements this interface should be sent as a parameter in a method call from C++ to Java, so this is like registration of callback class from C++ to Java. This way, whenever the Java code needs to send notifications to C++ code, it can call the methods of the C++ registered class. How to achieve this in JNI?
What I have tried:
I can not try but it is possible or not?