i planning to call form Java some native Method's but i need to send A list of some ASN1 SEQUENCES.
I search in the Internet but i did found some example has anybody a example for me or can explain what i must do?
Edited by: EJP on 13/07/2011 15:55: fixed your title
It s sounds like to me you need to
- encode you data as an ASN.1 sequence. (Not something specific to Java, I suggest you google this)
- call the native method. (I suggest you ask who ever wrote the native method for more details)
What is the difficulty you are having?
The Problem is that, i need also to send some other data, was is not define in Asn1.
The other thing i haven't a asn1 Compiler for Java and it is expensive to buy one.
Is there any way to send structs with JNI ? or must i split the struct in native types?
If you have a C method that you want to call then you write C code to call it.
Notice in the above that there is nothing about Java nor JNI.
JNI exists to move data to and from C code. Nothing else.
What the C code does after that is up to you.
maybee i write a bit confused
I need to call a C method from an Java Osgi bundle. To call the Method I need to send some data to my c Application so that i can there call the c Method.
The Problem is now that the data is not constant. Because the c Method need to call with a Array of Structs. And I don't know how to implement this with jni.
The first thing you have to do is define the native method(s) you need, with the appropriate parameters. There being no structs in Java you will have to use classes instead.
Then you use the javah tool to generate skeletal .h and .c files from the .class files. Then you write the code in the .c file to get the data out of the native method's parameters and call your C functions.