Re: java to native code and Sun JVM alternatives

Andrew Haley <[email protected]>
Newsgroups gmane.comp.gcc.java.devel
Message-ID <[email protected]>
On 03/14/2010 03:36 PM, wagde wrote:

> Thanx Andrew for the quick reply.
> 
> I'm trying to link my c code and I get:
> undefined reference to `JNI_CreateJavaVM'
> Although I have -lgcj in my ld command and it's the only undefined symbol in
> my code.
> Why is that?

You need to link with -ljvm.

> I still don't understand how JNI_CreateJavaVM will create a gij VM and not
> sun JAVA VM. can you explain this to me.

It's in gcj's libjvm.so, not Sun's.  You have to make sure you link with
gcj's version of libjvm by putting it in the path at link time.

Andrew.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.