Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Oct 2000 09:44:10 -0600
From:      "Long, Scott" <scott_long@btc.adaptec.com>
To:        "'Greg Lewis'" <glewis@trc.adelaide.edu.au>, Henrik.Nilsson@west.se
Cc:        freebsd-java@freebsd.org
Subject:   RE: Re: native java on freebsd
Message-ID:  <3E0B8684A39BD411BB560000D11ABE9206E7F5@btcexc01.btc.adaptec.com>

next in thread | raw e-mail | index | archive | help
Speaking as someone who is supporting Java/JNI of FreeBSD for a commercial
app, putting JNI's into a path already named by ldconfig (/usr/local/lib,
for example) has yielded the best results.

Scott

-----Original Message-----
From: Greg Lewis [mailto:glewis@trc.adelaide.edu.au]
Sent: Wednesday, October 11, 2000 2:56 AM
To: Henrik.Nilsson@west.se
Cc: freebsd-java@freebsd.org
Subject: Re: Re: native java on freebsd


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


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?3E0B8684A39BD411BB560000D11ABE9206E7F5>