Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2000 18:25:58 +0930 (CST)
From:      Greg Lewis <glewis@trc.adelaide.edu.au>
To:        Henrik.Nilsson@west.se
Cc:        freebsd-java@freebsd.org
Subject:   Re: Re: native java on freebsd
Message-ID:  <200010110855.SAA00169@ares.trc.adelaide.edu.au>
In-Reply-To: <200010110812.e9B8CEY31034@mail.west.se> from Henrik Nilsson at "Oct 11, 2000 10:10:59 am"

next in thread | previous in thread | raw e-mail | index | archive | help
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




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