It's not a secret anymore!
The moose likes Java in General and the fly likes Awkward question regarding JNI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Awkward question regarding JNI" Watch "Awkward question regarding JNI" New topic

Awkward question regarding JNI

Shyam Purkayastha
Ranch Hand

Joined: Jan 15, 2001
Posts: 57
Hi friends
i have got a piculiar question regarding jni.i am a newbie in jni and have tried basic programs from the sun java tutorial.It really worked.
I understand that the method has to be defined as native and the corrosponding code has to be written in c and created into a library file.But whatever examples i have seen uptil now have involved calling only individual methods.Suppose that i have a C++ class library which i want to use in a java program.Obviously it is better to call the library using jni than to create the java equvalent of the library.I want to know wheather it is possible to call c++ objects and their corrosponding methods using jni and if yes then how.
I tried this concept by creating a small class and making objects of it inside a native method but my visual c++ compiler is giving all sorts of errors.Can anybody help.
I agree. Here's the link:
subject: Awkward question regarding JNI
It's not a secret anymore!