[kaffe] Problem using javah

Samuel Richard Samuel.Richard at USherbrooke.ca
Wed Jul 21 10:07:12 PDT 2004


Hi,

I'm new to JNI and I am trying to follow the little tutorial provided by
Sun to get to know how native interface works.  However, I'm having some
difficulties with javah.  Here's what I do.

First, I have compiled that little class without any problem:

class HelloWorld {
    public native void displayHelloWorld();

    static {
        System.loadLibrary("hello");
    }
    
    public static void main(String[] args) {
        new HelloWorld().displayHelloWorld();
    }
}

[sam at localhost test_JNI]$ /usr/local/kaffe/bin/javac HelloWorld.java
[sam at localhost test_JNI]$ ls
HelloWorld.class  HelloWorld.java
[sam at localhost test_JNI]$

Everything works like expected so far.  Now, when I try to generate the
.h file, things get ugly.

[sam at localhost test_JNI]$ ls
HelloWorld.class  HelloWorld.java
[sam at localhost test_JNI]$ /usr/local/kaffe/bin/javah -classpath
/usr/local/kaffe/jre/lib/rt.jar -jni HelloWorld
Failed to open object 'HelloWorld'
[sam at localhost test_JNI]$

and the generated .h looks like that:

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
 
#ifndef _Included_HelloWorld
#define _Included_HelloWorld
 
#ifdef __cplusplus
extern "C" {
#endif
 
which is obviously incomplete.


Anybody knows what I am doing wrong?  Maybe I need to point CLASSPATH to
Klasses.jar, but I can't find it anywere.  By the way, I use kaffe
version 1.1.4 which I built for my x86 linux box.

Thanks,

Sam












More information about the kaffe mailing list