Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Aug 2001 12:53:30 -0400 (EDT)
From:      Brian Skrab <bgs@pinky.us.net>
To:        Greg Lewis <glewis@eyesbeyond.com>
Cc:        "freebsd-java@FreeBSD.ORG" <freebsd-java@FreeBSD.ORG>
Subject:   Re: FBSD 4.4-RC && Linux JDK 1.3.1 && JNI ???
Message-ID:  <20010820124457.A71396-100000@pinky.us.net>
In-Reply-To: <20010819032954.A19679@misty.eyesbeyond.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Greg,

	The linux-devel port (and a quick search on google) provided the
	solution.

	1. Compile the C into Linux object code:
	   /usr/compat/linux/usr/bin/cc \
	      -I/usr/local/jdk/include \
	      -I/usr/local/jdk/include/linux \
	      -I. -c JNITest.c -o JNITest.o

	2. Turn object code into Linux shared object code:
	   /usr/compat/linux/usr/bin/cc -shared JNITest.o -o libjnitest.so

	3. Compile Java class
	   jikes JNITest.java

	4. Run Java class, making sure that libjnitest.so is in library path:
	   java -Djava.library.path=. JNITest

	Many thanks to all those who contributed advice.

	~brian skrab
	 bgs@pinky.us.net

On Sun, 19 Aug 2001, Greg Lewis wrote:

> On Fri, Aug 17, 2001 at 11:13:37PM -0400, Brian Skrab wrote:
> > 	I've just dipped my big toe into the dark and mysterious pool of the
> > 	Java Native Interface.  I've implemented a simple HelloWorld style
> > 	application with a native C implementation of the print method, and
> > 	have managed to get to the final step of running the class only to
> > 	receive the following error:
> >
> > 	jnitest.so: /usr/home/bgs/bin/libjnitest.so: ELF file OS ABI invalid.
> [snip]
> >
> > 	I am using the Linux JDK 1.3.1 port and am unsure about where to go
> > 	from here.  Is there something special that I must do when compiling
> > 	the native code to make it properly executable?  I've seen brandelf
> > 	mentioned in a few archives that I've searched in, but have tried
> > 	using it with no success.
> >
> > 	Anyone know the secret incantations to make JNI work with a Linux
> > 	JDK?  Any pointers, tips, or *examples* are very much appreciated.
>
> Install the linux-devel port and compile with the build tools supplied
> by it or build the shared library on a Linux box.
>
> You can't mix object formats.
>
> --
> Greg Lewis                            Email : glewis@eyesbeyond.com
> Eyes Beyond                           Phone : (801) 765 1887
> Information Technology                Web   : http://www.eyesbeyond.com
>
>
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-java" in the body of the message
>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-java" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010820124457.A71396-100000>