Basic tech stuff

Programming and Linux administration


Posted by Daniel Brahneborg on 2008 January 30

Jay me!

By using the example from the JNI documentation, fixing the errors, and then figuring out the not entirely obvious command lines for compiling, linking and running it, I now have a C program that can talk to Java.

On my Fedora Core 3 box I had to build and run it like this:

gcc -o runjava runjava.c -L/usr/java/jdk1.5.0_11/jre/lib/i386/client -ljvm
LD_LIBRARY_PATH=/usr/java/jdk1.5.0_11/jre/lib/i386/client ./runjava

I bet there is some nice shortcut for that, like `javaconfig -cflags` or something, but I haven’t found that one yet.

Using JNI doesn’t seem entirely difficult, especially since we’re only going to use very few arguments, and the same method signature for all calls. I hope our customers will like that they don’t have to write plugins in C anymore, but can use nicer languages.

Andra bloggar om: , , .

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: