944,144 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 8873
  • Java RSS
Apr 3rd, 2005
0

Invoke Java library from C/C++

Expand Post »
Hello everyone,


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


Thanks in advance,
George
Similar Threads
Reputation Points: 11
Solved Threads: 0
Junior Poster
George2 is offline Offline
189 posts
since Nov 2004
Apr 3rd, 2005
0

Re: Invoke Java library from C/C++

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/ossdoc...ing/index.html

This is a tutorial on the Java Native Interface

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

I hope this helps you

Yours Sincerely

Richard West
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004
Apr 4th, 2005
0

Re: Invoke Java library from C/C++

Thanks freesoft_2000,


Quote originally posted by 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/ossdoc...ing/index.html

This is a tutorial on the Java Native Interface

http://www.javaworld.com/javaworld/j...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
Reputation Points: 11
Solved Threads: 0
Junior Poster
George2 is offline Offline
189 posts
since Nov 2004
Apr 4th, 2005
0

Re: Invoke Java library from C/C++

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
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004
Apr 5th, 2005
0

Re: Invoke Java library from C/C++

Thanks freesoft_2000,


Quote originally posted by George2 ...
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
Reputation Points: 11
Solved Threads: 0
Junior Poster
George2 is offline Offline
189 posts
since Nov 2004
Apr 9th, 2010
0
Re: Invoke Java library from C/C++
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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hasrule is offline Offline
6 posts
since Apr 2010

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Exception in thread "main" java.lang.NullPointerException error
Next Thread in Java Forum Timeline: Having Multible errors





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC