I have another problem about bundle and JNI.
Now, in my java bundle code as follows, this java bundle need to use JNI to
get some data from C/C++ program via for the function: getPressedKeyCode()
which is defined in getPressedCode.c .

//--------------------------------------------------------------------------------//

//-------------------------- getPressedCode.java---------------------//
package tmp.getpressedcode;

import org.osgi.framework.BundleActivator ;
import org.osgi.framework.BundleContext;

public class getPressedCode  implements BundleActivator
{
    static
    {
        //load library according to the rule of JNI technology
        System.loadLibrary ("getPressedCode");  //load library
    }

    //this function would be defined in C/C++ file
    public native static void getPressedKeyCode();

    public void start(BundleContext context) throws Exception
    {
        getPressedKeyCode();
    }
    public void stop(BundleContext context) throws Exception
    {
    }
}
//-------------------end-------------------------------------------------------------//


I removed the first sentence about package and use JNI mechanism to creat
the related lib and link to it properlly, and I have tred to use this link
lib via another test file, and find this JNI getPressedKeyCode() function
is ok to run.

However, when I build this getPressedCode.java into myBundle.jar file, find
it can't work after installing in knopflerfish osgi framwork.
So, how to handl this bundle which need to use JNI mechanism?
Many thanks to you!

Jerry
_______________________________________________
OSGi Developer Mail List
[email protected]
http://www2.osgi.org/mailman/listinfo/osgi-dev

Reply via email to