Riyad Kalla wrote:

> Wait... what is JNI? And why does all that code at the bottom look so
> complicated for "Hello World"?
>
> Thanks in advance.
>
> Riyad
>
> ----------
> > From: Marcel Ruff developer <[EMAIL PROTECTED]>
> > To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> > Subject: JNI from JDK1.2 on Linux-2.0.36 hangs in method
> JNI_CreateJavaVM()
> > Date: Friday, April 16, 1999 6:35 AM
> >
> > Hi,
> >
> > My little JNI HelloWorld C++ program hangs when invoking
> > JNI_CreateJavaVM() with following output:
> >
> > >  export LD_BIND_NOW=true
> > >  export RTLD_NOW=true
> > >  invokecpp
> >     <GC: need to expand mark bits to cover 16384 bytes>
> >     [Opened /usr/local/jdk1.2Pre1/jre/lib/rt.jar in 29 ms]
> >     [Opened /usr/local/jdk1.2Pre1/jre/lib/i18n.jar in 4 ms]
> >
> > -> here it stays forever ....
> >
> > The old version, calling the JDK 1.1 interface (Blackown Java 1.1.7)
> > runs fine.
> >
> > CAN ANYBODY PROVIDE ME  A LITTLE HELLOWORLD JNI SAMPLE CODE WHICH WORKS?
> >
> > I couldnt find any example for the new JDK-2 JNI API, so perhaps im
> > using it wrong.
> >
> >
> > My Environment:
> > -------------
> > - Pentium Linux  2.0.36 with glibc
> > - jdk1.2pre-v1.tar from Blackdown
> >
> >
> > How i compiled it:
> > -------------
> > export LD_BIND_NOW=true
> > export RTLD_NOW=true
> > g++ -D_REENTRANT -I/usr/local/jdk/include -I/usr/local/jdk/include/linux
> > invoke.C -o invokecpp  -L/usr/local/jdk/jre/lib/i386 -ljava -L
> > /usr/local/jdk/jre/lib/i386/native_threads -lhpi
> > -L/usr/local/jdk/jre/lib/i386/classic -ljvm
> >
> >
> > How invoke.C looks like:
> > ------------------
> > #include <jni.h>
> >
> > main()
> > {
> >     JNIEnv *env;
> >
> >   JavaVMInitArgs vm_args;
> >     JavaVMOption options[4];
> >
> >     options[0].optionString = "-Djava.compiler=NONE";           /*
> > disable JIT */
> >     options[1].optionString = "-Djava.class.path=.";            /* user
> > classes */
> >     options[2].optionString = "-Djava.library.path=.";          /* set
> > native library path */
> >     options[3].optionString = "-verbose:jni,class,gc";          /* print
> > JNI-related messages */
> >
> >     vm_args.version = JNI_VERSION_1_2;
> >     vm_args.options = options;
> >     vm_args.nOptions = 4;
> >     vm_args.ignoreUnrecognized = JNI_TRUE;
> >
> >     JavaVM *jvm;
> >     jint res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
> > .....  here it hangs :-(
> >
> >
> > Thanks very much for any hint,
> >
> > Marcel
> >
> > PS: Please send answers to [EMAIL PROTECTED] as well
> >
> >
> > ----------------------------------------------------------------------
> > To UNSUBSCRIBE, email to [EMAIL PROTECTED]
> > with a subject of "unsubscribe". Trouble? Contact
> [EMAIL PROTECTED]
> >
> 

JNI ist the nativ interface from Java, to acces C/C++ etc.

I use Java-Swing as my portable GUI toolkit for our C++ software.


Marcel


----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to