I need to call a COM object written in C++ via Java JNI. I don't have documentation of the COM object API so I was wondering if there is a way to "enquire" the object itself. I have an example written in VBA which calls one function on the COM object, but when I try to replicate the same call using a JNI native methoud I get the following error. I assume I'm making a mistake in one of the arguments types or the return type (VBA doesn't define the return type).
Exception in thread "main" java.lang.UnsatisfiedLinkError: MyWrapper.functionOne(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Boolean;)V
at MyWrapper.funtionOne(Native Method)
at MyWrapper.main(MyWrapper.java:22)
You cannot directly call a COM object via JNI. JNI is for calling functions that have been declared with JNI syntax and objects.
If you would like to call directly, you need to use the Java Native Access(JNA) libraries. Its very similar to .Net P/Invoke syntax.
See: https://github.com/twall/jna