Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forumsjni problem
https://www.eclipse.org/forums/index.php/mv/msg/214569/686313/#msg_686313
I created a java source file, a header file and the shared object library all outside
of eclipse.
Everything runs fine.
Next I imported the java source into a package of my eclipse project.
Eclipse compiled the java source.
I then went to the bin directory in the eclipse project.
I ran javah to create the header file.
I copied the header file to the project package folder.
I compiled the shared object library from the command line (gcc...).
The loadLibrary seems to work, but the call to the native function is not found.
Java is looking for a native function with the java package name as a prefix.
Thanks, Paul]]>James Wolfe2011-06-22T02:23:22-00:00Re: jni problem
https://www.eclipse.org/forums/index.php/mv/msg/214569/686373/#msg_686373
Satyam Kandula2011-06-22T06:12:32-00:00Re: jni problem
https://www.eclipse.org/forums/index.php/mv/msg/214569/686628/#msg_686628
I did as you suggested. I renamed the c function to include the package name and
all is well.
I am still unclear as to how to run javah on a class that is a member of a package.
I tried,
javah -jni ExternalSignatureNoiseCCPP
in the bin directory containing the class file.
I got,
error: cannot access ExternalSignatureNoiseCCPP
bad class file: RegularFileObject[./ExternalSignatureNoiseCCPP.class]
class file contains wrong class: irSensor.ExternalSignatureNoiseCCPP
Please remove or make sure it appears in the correct subdirectory of the classpath.
I tried,
javah -jni irsensor.ExternalSignatureNoiseCCPP
I got
error: cannot access irsensor.ExternalSignatureNoiseCCPP
class file for irsensor.ExternalSignatureNoiseCCPP not found
So, to restate my question.
What is the command to run javah on a class file that came from a source in some package.
Thanks again, paul
]]>James Wolfe2011-06-22T16:01:31-00:00Re: jni problem
https://www.eclipse.org/forums/index.php/mv/msg/214569/687741/#msg_687741
from the bin folder and not from irsensor. ]]>Satyam Kandula2011-06-23T06:00:25-00:00Re: jni problem
https://www.eclipse.org/forums/index.php/mv/msg/214569/688583/#msg_688583
and to add a class path to the bin directory.
cd ../bin
javah -classpath ./bin irSensor.ExternalSignatureNoiseCCP