Hi all!
Suppose I want to create and distribute a library for use with Sun's
wireless toolkit. The library consists of a number of Java classes and
a DLL containing some native code. Is this possible at all? I know of
the following problems:
* The KVM doesn't support JNI. However, my understanding is that the
emulator in WTK uses the J2SE VM, so it should be possible anyway.
* The preverifier fails for classes using native declarations. But
mustn't the WTK itself use some native code? And there should be no
reason for this code to be pre-verified as it's runnning in the J2SE
VM. Correct? The question is, how can I add this kind of code to the
WTK?
I hope I'm making myself understood. :) Any help or thoughts about this
would be very appreciated. Thanks in advance!
/Daniel
Roedy Green - 27 Oct 2005 01:00 GMT
>* The preverifier fails for classes using native declarations. But
>mustn't the WTK itself use some native code?
JNI is more than just native classes. It is a library of methods you
can call from C. It is the javah utility. It is a set of C headers.
It is a bunch of glue for hooking up JNI. I would hope the built-in
native classes go through a more efficient mechanism than JNI that
does not require runtime hookup.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
Darryl L. Pierce - 27 Oct 2005 12:38 GMT
> Suppose I want to create and distribute a library for use with Sun's
> wireless toolkit. The library consists of a number of Java classes and
> a DLL containing some native code. Is this possible at all?
Why not just use the MIDP reference implementation, which comes with
source code and which can be used (once you've licensed it) to make a
customized MIDP environment as you're desiring.

Signature
Darryl L. Pierce <mcpierce@gmail.com>
Homepage: http://mcpierce.multiply.com/
"Bury me next to my wife. Nothing too fancy..." - Ulysses S. Grant