This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Does jni work?

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

$ ./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/
   at 0x4018d8f0: java::lang::Exception::Exception(java::lang::String*) (/home/bryce/gcc/lib/
   at 0x4018c990: java::lang::ClassNotFoundException::ClassNotFoundException(java::lang::String*)
   at 0x40215b46: java::net::URLClassLoader::findClass(java::lang::String*) (/home/bryce/gcc/lib/
   at 0x4018c00c: java::lang::ClassLoader::loadClass(java::lang::String*, bool) (/home/bryce/gcc/lib/
   at 0x4017b5ea: _Jv_FindClass(_Jv_Utf8Const*, java::lang::ClassLoader*) (/home/bryce/gcc/lib/
   at 0x40166d07: _Jv_GetJavaVM() (/home/bryce/gcc/lib/
   at 0x405828d3: Java_sample_myNative (./
   at 0x0804bc30: sample::myNative(java::lang::String*) (/home/bryce/tests/jni/

It looks like the GetStaticField() etc implementations may need some work.


  [ bryce ]

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]