A simple example for calling an existing java code from c using jni?

Joined
Oct 14, 2010
Messages
1
Reaction score
0
Points
1
I have an existing java code and I want to use its function in c language. As I found till now I should use jni. I have read a sample in this link:
Java programming with JNI
If I want to compile the c code with the command below I have to change the code a little.Because of the last sentence that has mentioned in this link:
Re: JNI NIO early compilation error

I use these command to compile:
g++ -framework -I/System/Library/Frameworks/JavaVm.fram… -c Sample2.c -o Sample2.o
I got this as result :
i686-apple-darwin10-g++-4.2.1: cannot specify -o with -c or -S with multiple files

and it doesn't work! and I don't know how should I compile and run it.:-(
and I even know what's wrong with that!
Can you please put any comment on this ? Or do you know another way to do what I'm going to do.
thanks.:)
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top