Does jni work?
Bryce McKinlay
bryce@albatross.co.nz
Thu Jan 25 18:01:00 GMT 2001
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 ]
More information about the Java
mailing list