Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > How to call Java from C++?

Reply
Thread Tools

How to call Java from C++?

 
 
tony_lincoln@yahoo.com
Guest
Posts: n/a
 
      08-09-2005
Dear Friends,

I know that if you call C++ from java, you have to use JNI. But how to
call Java from C++?

Thanks a lot.
Tony

 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      08-09-2005
On 9 Aug 2005 05:55:39 -0700, wrote:
> I know that if you call C++ from java, you have to use JNI. But how
> to call Java from C++?


Much of what you do in native methods involves making calls from C to
Java methods, or accessing fields in Java objects. In other words
there is no real distinction, you use JNI for calls in both
directions.

If you also want to launch a JVM from C, there are a small number of
functions described in the JNI spec under "invocation" for just that
purpose.

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
 
 
 
tony_lincoln@yahoo.com
Guest
Posts: n/a
 
      08-09-2005
Are there any other better methods except JNI?
Thanks a lot
tony

 
Reply With Quote
 
jan V
Guest
Posts: n/a
 
      08-09-2005
> Are there any other better methods except JNI?

Can the C++ program be changed? If so, how about letting the two talk over
some TCP connection? Or use CORBA if sockets are too low level for you..


 
Reply With Quote
 
tony_lincoln@yahoo.com
Guest
Posts: n/a
 
      08-09-2005
Unfortunately C++ program is huge and can not be changed. Is there any
better solutions?Thank a lot.

 
Reply With Quote
 
jan V
Guest
Posts: n/a
 
      08-09-2005
> Unfortunately C++ program is huge and can not be changed.

Well, if it can NOT be changed, and it doesn't ALREADY have a C -> Java
communications solution in place, then clearly you're going to need magic to
make it communicate with Java, or am I missing something here?


 
Reply With Quote
 
Joan
Guest
Posts: n/a
 
      08-09-2005

"jan V" <> wrote in message
news:FN8Ke.165664$...
>> Unfortunately C++ program is huge and can not be changed.

>
> Well, if it can NOT be changed, and it doesn't ALREADY have a
> C -> Java
> communications solution in place, then clearly you're going to
> need magic to
> make it communicate with Java, or am I missing something here?
>

I think the OP means that he should do nothing and tomorrow
morning it works.

 
Reply With Quote
 
Joan
Guest
Posts: n/a
 
      08-09-2005

"jan V" <> wrote in message
news:FN8Ke.165664$...
>> Unfortunately C++ program is huge and can not be changed.

>
> Well, if it can NOT be changed, and it doesn't ALREADY have a
> C -> Java
> communications solution in place, then clearly you're going to
> need magic to
> make it communicate with Java, or am I missing something here?
>

Sorry, I forgot, you can use pipes.

 
Reply With Quote
 
alan@ljubljana.agtrz.com
Guest
Posts: n/a
 
      08-10-2005
On 2005-08-09, Joan <> wrote:
>
> "jan V" <> wrote in message
> news:FN8Ke.165664$...
>>> Unfortunately C++ program is huge and can not be changed.

>>
>> Well, if it can NOT be changed, and it doesn't ALREADY have a
>> C -> Java
>> communications solution in place, then clearly you're going to
>> need magic to
>> make it communicate with Java, or am I missing something here?
>>

> I think the OP means that he should do nothing and tomorrow
> morning it works.


There's an article in the July 2005 C/C++UJ for a project called
NoodleGlue that bridges C++ to Java. Take a look.

--
Alan Gutierrez -
- http://engrm.com/blogometer/index.html
- http://engrm.com/blogometer/rss.2.0.xml
 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      08-10-2005
On 9 Aug 2005 05:55:39 -0700, wrote or quoted :

>I know that if you call C++ from java, you have to use JNI. But how to
>call Java from C++?


You use JNI. It is just a bit more complicated. I strongly recommend
buying a text on this one. The free docs are not adequate.

See http://mindprod.com/jgloss/jni.html


--
Bush crime family lost/embezzled $3 trillion from Pentagon.
Complicit Bush-friendly media keeps mum. Rumsfeld confesses on video.
http://www.infowars.com/articles/us/...s_rumsfeld.htm

Canadian Mind Products, Roedy Green.
See http://mindprod.com/iraq.html photos of Bush's war crimes
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java Native Interface: "Translate" java call to JNI ckirchho@directmedia.de Java 13 10-09-2006 04:52 PM
Call Manager limit call duration nazgulero Cisco 0 10-25-2005 06:58 AM
How to make landline call to another landline then out call long distance? jt VOIP 6 01-30-2005 03:57 AM
RMI: remote call or local call Buu Nguyen Java 5 09-17-2004 08:05 AM
help: need to call call web service from java bill sandner Java 1 07-01-2004 02:57 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57