This is the mail archive of the
java-discuss@sources.redhat.com
mailing list for the Java project.
Re: Does jni work?
- To: martin dot kahlert at infineon dot com
- Subject: Re: Does jni work?
- From: Bryce McKinlay <bryce at albatross dot co dot nz>
- Date: Fri, 26 Jan 2001 15:05:12 +1300
- CC: java-discuss at sourceware dot cygnus dot com
- References: <20010125150254.A5131@keksy.muc.infineon.com>
Martin Kahlert wrote:
> I tried to get a jni test working. I started by the example on the web and
> adjusted to compile with gcj (newest snapshot 2001-01-22 on linux)
>
> Did i make any mistake, or is this known not to work?
Your example works for me, once I corrected the System.loadLibrary() call and added "." to LD_LIBRARY_PATH. At least, it partly
works:
$ ./sample
Hello, Java
From C
java/lang/System::out lookup failed
Exception in thread "main" java.lang.ClassNotFoundException: Ljava/io/PrintStream;
at 0x40199289: java::lang::Throwable::Throwable(java::lang::String*) (/home/bryce/gcc/lib/libgcj.so.1)
at 0x4018d8f0: java::lang::Exception::Exception(java::lang::String*) (/home/bryce/gcc/lib/libgcj.so.1)
at 0x4018c990: java::lang::ClassNotFoundException::ClassNotFoundException(java::lang::String*)
(/home/bryce/gcc/lib/libgcj.so.1)
at 0x40215b46: java::net::URLClassLoader::findClass(java::lang::String*) (/home/bryce/gcc/lib/libgcj.so.1)
at 0x4018c00c: java::lang::ClassLoader::loadClass(java::lang::String*, bool) (/home/bryce/gcc/lib/libgcj.so.1)
at 0x4017b5ea: _Jv_FindClass(_Jv_Utf8Const*, java::lang::ClassLoader*) (/home/bryce/gcc/lib/libgcj.so.1)
at 0x40166d07: _Jv_GetJavaVM() (/home/bryce/gcc/lib/libgcj.so.1)
at 0x405828d3: Java_sample_myNative (./libsample.so)
at 0x0804bc30: sample::myNative(java::lang::String*) (/home/bryce/tests/jni/sample.java:2)
...
It looks like the GetStaticField() etc implementations may need some work.
regards
[ bryce ]