By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,209 Members | 1,706 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,209 IT Pros & Developers. It's quick & easy.

Calling Java object/methods from C++

P: n/a
Hi,

I am looking for reference books/tools/code samples for calling java
objects/methods from COM/C++ classes.

I am reasonably familiar with JNI. If you have used JNI, please let me know
of your experiences and things that I need to watch out. I have used JNI 1.1
and it had several bugs and limitations especially for C++ calling Java. Is
the newer version of JNI (version 1.4) any better?

Please send your reply to my email. Thanks for your help.

Radha
kr*****@cisco.com
Jul 22 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rhdha,

Well, I knew that you could use JNI to call C/C++ code, but was unaware
that you could do the reverse with it. Also, your experience with JNI
1.1 has been experienced by many others as well. Since then, I can
assure you that things have gotten more stable.

I have a feeling that should you wish to call JAVA objects from C++,
then you will be limited to the only tool chain available I know of
which can accomplish this, the GCC tool chain. Included you will find
GCJ ( http://gcc.gnu.org/java/ ) which is capable of hosting resonably
complex JAVA legacy libraries which can then be called by your new C++ code.

As for an example, it just so happens that there is a new plugin for
Mozilla provided by the GCJ project for running applets (why you would
want to do this, I'm not sure). While this might be a little large of an
example, their list server community might in turn be able to get you
started on your way.

Radha News wrote:
Hi,

I am looking for reference books/tools/code samples for calling java
objects/methods from COM/C++ classes.

I am reasonably familiar with JNI. If you have used JNI, please let me know
of your experiences and things that I need to watch out. I have used JNI 1.1
and it had several bugs and limitations especially for C++ calling Java. Is
the newer version of JNI (version 1.4) any better?

Please send your reply to my email. Thanks for your help.

Radha
kr*****@cisco.com


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFAKr9uoo/Prlj9GScRAiyHAJ4qU165tYtZY6uvBuXmXNW3/SDA1wCeNC8n
+Y6zCS2HBFDGGbVv/q3JrWY=
=QEF5
-----END PGP SIGNATURE-----
Jul 22 '05 #2

P: n/a
Evan Carew wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Rhdha,

Well, I knew that you could use JNI to call C/C++ code, but was unaware
that you could do the reverse with it. Also, your experience with JNI
1.1 has been experienced by many others as well. Since then, I can
assure you that things have gotten more stable.

I have a feeling that should you wish to call JAVA objects from C++,
then you will be limited to the only tool chain available I know of
which can accomplish this, the GCC tool chain. Included you will find
GCJ ( http://gcc.gnu.org/java/ ) which is capable of hosting resonably
complex JAVA legacy libraries which can then be called by your new C++
code.


JNI allows any C/C++ code to call it. It is called the Invocation
Interface:

http://java.sun.com/docs/books/jni/h...oke.html#11202

Jim S.
--
Remove my extraneous mandibular appendages to reply via email.
Jul 22 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.