This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: GCJ .jar to .so with native method
Joe Hoffert writes:
> Hi, Andrew.
>
> On Tue, 2007-12-04 at 15:16 +0000, Andrew Haley wrote:
>
> OK. I've attached a zip file with everything that should be needed. The
> gcj-commands file simply contains the gcj and gcjh commands I used to
> generate the .so library and the .h header files.
Works for me:
zorro:tmp $ gcjh -classpath ./ricochet.jar multishot.examples.RicochetApp
zorro:tmp $ gcj -shared -fPIC -Wl,-Bsymbolic ./ricochet.jar -o libricochet.so
zorro:tmp $ gcj RicochetAppMain.cpp -L. -lricochet -fPIC -lstdc++
cc1plus: warning: command line option "-fbootclasspath=./:/usr/share/java/libgcj-4.1.2.jar" is valid for Java but not for C++
zorro:tmp $ LD_LIBRARY_PATH=. ./a.out
Usage: RicochetApp GMS_id FDS_id startPortNumber [propertyString]
You really need to call JvCreateJavaVM() first.
If this doesn't give you the same results, the problem is likely to be
that you need a new version of gcj.
Andrew.
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903