aspose file tools*
The moose likes Other JSE/JEE APIs and the fly likes jni methos in c++ class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "jni methos in c++ class" Watch "jni methos in c++ class" New topic
Author

jni methos in c++ class

bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
hi,

I have a silly doubt, but it is worth so much for my project.

Is it possible to declare jni methods in c++ class...

till now i have jni with no c++ class

example

this is the java class



this is the c++ code. it has no class



these (JNIEXPORT jint JNICALL Java_testin_Mod) are from the header file created from the java file...

now i have c++ class and i need jni to be integrated to some of the methods of that class. but it is thowing error from the java class where i call the c++ method...


any help please..

thanks in advance

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19556
    
  16

Have you compiled the C++ file as a DLL file? Is that DLL file called test.dll? Is that DLL file in a folder in the java.library.path?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
bharani rao
Ranch Hand

Joined: Apr 06, 2009
Posts: 164
rob,

i'm workin in linux.
i created the so file..
placed that in /usr/lib<something> folder

when running i get these errors because there is a class in c++...

it is working fine if i place that JNIEXPORT etc., outside the class.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jni methos in c++ class
 
Similar Threads
From where can I get 'jni.h' file???
how to link .net dll to java
convert jbyteArray into jString ?
JNI What is it, and can I use it
does java support shared memory concept