Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

wrapping native C++ methods/classes in Java

843829Nov 26 2008 — edited Nov 27 2008
Hi!

I'm new to JNI and need an advice asap as I have an urgent problem to solve. Any comment is more than welcome
I have a native legacy library written in C++ (a dll file)
There is already some jni work done for a part of the methods of the native library, done by some other developer in the past
Now I want to extend the jni wrapping he did and I need to wrap in java one abstract class from the native C++ library and one method from the dll

let's name the class C and the method is something like boolean aMethod( C c, D d)
it takes one parameter an object of the abstract class C which I have to wrap in Java and the second is an object of type D which is already wrapped in java.

I was thinking to add in the existing jni implementation the declarations for abstract class C and for method aMethod
That I can do but I'm not sure what are the next steps. As far as I read, I need to generate a header C file (javah) and a wrapper dll?
Can you please advice me what I need to do after adding the java code for class C and for method aMethod in order to have the jni code working?

With best regards
Sorin

Edited by: Sorin on Nov 26, 2008 10:00 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 25 2008
Added on Nov 26 2008
3 comments
479 views