From owner-freebsd-java Wed Oct 11 1:56:13 2000 Delivered-To: freebsd-java@freebsd.org Received: from ares.trc.adelaide.edu.au (ares.trc.adelaide.edu.au [129.127.246.5]) by hub.freebsd.org (Postfix) with ESMTP id F342A37B66D for ; Wed, 11 Oct 2000 01:56:08 -0700 (PDT) Received: (from glewis@localhost) by ares.trc.adelaide.edu.au (8.9.3/8.9.3) id SAA00169; Wed, 11 Oct 2000 18:25:58 +0930 (CST) (envelope-from glewis) From: Greg Lewis Message-Id: <200010110855.SAA00169@ares.trc.adelaide.edu.au> Subject: Re: Re: native java on freebsd In-Reply-To: <200010110812.e9B8CEY31034@mail.west.se> from Henrik Nilsson at "Oct 11, 2000 10:10:59 am" To: Henrik.Nilsson@west.se Date: Wed, 11 Oct 2000 18:25:58 +0930 (CST) Cc: freebsd-java@freebsd.org X-Mailer: ELM [version 2.4ME+ PL70 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Henrik Nilsson wrote: > > The environment variable LD_LIBRARY_PATH needs to contain the path where > > the shared library can be found. > > > > HTH! > > It shared some light on the matter, but things still looks a bit hazy =) > > I have put the libhello.so (a simple hello world printout thingy) in > /usr/lib and it actually seems to find it. (because when I remove it I get > cannot find libhello.so error) Note what I said about LD_LIBRARY_PATH above. There is of course, the other option, which you took, of placing the library into a system directory which is searched for shared libraries as well. But in general you'll have to set up LD_LIBRARY_PATH to include the directory where your shared library resides. > but if I follow the compile instructions from the jni tutorial on > javasoft.com, it just doesn't work. I don't know what those instructions are off hand. You need to compile a shared library is the only requirement. If the JNI tutorial has appropriate instructions for doing so with gcc then you should be ok. It should be something like: gcc -o libhello.so -shared -fpic hello.c > The error I get is:"/usr/lib/libhello.so: unsupported file type > (libhello.so)" Determine if its actually a shared library. The 'file' command is your friend. E.g., # file /usr/lib/libc.so.4 /usr/lib/libc.so.4: ELF 32-bit LSB shared object, Intel 80386, version 1 (FreeBSD), stripped > Maybe I haven't compiled it properly, have any thoughts on that? See above. - Greg To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message