Hello everyone,


Are there any approaches to invoke Java libraries from C/C++?


Thanks in advance,
George

Hi everyone,

What you are asking is rather difficult but you could ude something called the Java Native Interface

Here are a few links to point you to the right direction

http://www.acm.org/crossroads/xrds4-2/jni.html
http://home.pacifier.com/~mmead/jni/cs510ajp/index.html
http://www.science.uva.nl/ict/ossdocs/java/tutorial/native1.1/implementing/index.html

This is a tutorial on the Java Native Interface

http://www.javaworld.com/javaworld/jw-10-1999/jw-10-jni.html

I hope this helps you

Yours Sincerely

Richard West

Thanks freesoft_2000,

Hi everyone,

What you are asking is rather difficult but you could ude something called the Java Native Interface

Here are a few links to point you to the right direction

http://www.acm.org/crossroads/xrds4-2/jni.html
http://home.pacifier.com/~mmead/jni/cs510ajp/index.html
http://www.science.uva.nl/ict/ossdocs/java/tutorial/native1.1/implementing/index.html

This is a tutorial on the Java Native Interface

http://www.javaworld.com/javaworld/jw-10-1999/jw-10-jni.html

I hope this helps you

Yours Sincerely

Richard West

You are an expert and your reply is very helpful. I think you must know how JVM implements JNI internally. ;) Can you recommend some materials dealing with JNI internal implementation?


regards,
George

Hi everyone,

What happens is that the javah command converts the java source code to native code entry points. This command was provided for interfacing mainly for C/C++ but if you wish to use other languages then you will have to do your own translation of entry points and arguments thus creating your own version of javah for say pascal which is not recommended.

As for recommending about the internal implementation of jni in the jvm, i am not too sure about that and thus am unable to recommend articles about it

The link to the javaworld article especially on the second and third page talks more about the internal working between the jni and jvm.

Yours Sincerely

Richard West

Thanks freesoft_2000,

Thanks freesoft_2000,


You are an expert and your reply is very helpful. I think you must know how JVM implements JNI internally. ;) Can you recommend some materials dealing with JNI internal implementation?


regards,
George

Your reply is very helpful!


regards,
George

Hi freesoft_2000

I ve tried succesfully calling JVM and using Java fields from C++ as executable.
But when I tried to call Java method from C++ as shared library (.so, in UNIX). it failed.

Do you have any suggestion about that? Should I use socket communication instead?

regards,
Hasrul.

This article has been dead for over six months. Start a new discussion instead.