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
jhoffert@dre.vanderbilt.edu writes:
>
> > When asking a question like this, you are far more likely to get an
> > answer if you submit a runnable test case. That way I can see what's
> > going wrong. Right now, I have no idea.
>
> I've attached a zip file with my code. The example is about as small as
> what I sent you previously. (In fact, I made only some minor changes from
> what I sent you earlier, e.g., hard coding command line options). The
> commands that I used for building are in the file gcj-commands.
>
> I think I'm doing everything I'm supposed to be doing but the call to
> JvInitClass(&multishot::examples::RicochetApp::class$) seems to be
> failing. I'm not sure why.
>
> I do get the following message when I link with gcj (rather than g++):
>
> cc1plus: warning: command line option
> "-fbootclasspath=./:/usr/share/java/libgcj-4.1.2.jar" is valid for Java
> but not for C++
>
> I assuming this message isn't important but I may be mistaken.
No, it isn't important.
The problem occurs when your program calls
java.lang.System.loadLibrary(java.lang.String)void with the arg
"ricochet-jni". The library isn't there, so System.loadLibrary fails.
I don't know why it doesn't print a stack trace at that point: it
should. I'll investigate.
Andrew.
--
Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, UK
Registered in England and Wales No. 3798903