problem compiling JNI example

F

Federico

Hello,

I'm trying to build the SUN's JNI example
(http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step1.html),
but I cannot!!

I'm working on MacOS X, and I get the above error. Interestingly, the
jni.h exists at /System/Library/Frameworks/JavaVM.framework/Headers/,
even if the compiler says it doesn't. But that jni.h is a "link" and I
cannot do a simple "more" of it... (it says also "No such file or
directory")

Could you help me, please?

Thanks in advance!
Federico


cc -c -I/System/Library/Frameworks/JavaVM.framework/Headers HelloWorldImp.c

HelloWorldImp.c:1:17: jni.h: No such file or directory
In file included from HelloWorldImp.c:2:
HelloWorld.h:2:17: jni.h: No such file or directory
In file included from HelloWorldImp.c:2:
HelloWorld.h:15: error: syntax error before "void"
HelloWorld.h:16: error: parse error before '*' token
HelloWorld.h:16: warning: data definition has no type or storage class
HelloWorldImp.c:5: error: syntax error before "void"
HelloWorldImp.c:6: error: parse error before '*' token
 
G

Gordon Beaton

I'm trying to build the SUN's JNI example
(http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step1.html),
but I cannot!!

I'm working on MacOS X, and I get the above error. Interestingly,
the jni.h exists at
/System/Library/Frameworks/JavaVM.framework/Headers/, even if the
compiler says it doesn't. But that jni.h is a "link" and I cannot do
a simple "more" of it... (it says also "No such file or directory")

I don't really know how the JDK is organized on MacOS X, but would
assume that it isn't all that different to other platforms, in which
case jni.h should be in a place like /.../j2sdk/include/.

At any rate, the link is "broken". It needs to point to the real jni.h
but doesn't, which is why you can't read it with "more".

You need to find the real jni.h and the other header files that are
part of the JDK. Maybe you need to download a new JDK, since it sounds
like yours might be missing some files.

/gordon
 
S

Sam

Federico said:
Hello,

I'm trying to build the SUN's JNI example
(http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step1.html),
but I cannot!!

I'm working on MacOS X, and I get the above error. Interestingly, the
jni.h exists at /System/Library/Frameworks/JavaVM.framework/Headers/,
even if the compiler says it doesn't. But that jni.h is a "link" and I
cannot do a simple "more" of it... (it says also "No such file or
directory")

Could you help me, please?

Thanks in advance!
Federico

Frederico,

In Windows, it's in this library:

C:\j2sdk1.4.2_04\include

Mac may have some issues with JNI, check out this url:

http://developer.apple.com/technotes/tn/tn1155.html

Sam90
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top