www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Communication between Java and D application

reply "Anton Alexeev" <alexanto gmx.de> writes:
I have a method in a D program which I want to call from a Java 
program. What is the best way to do this?
Sep 13 2013
next sibling parent "Jonathan M Davis" <jmdavisProg gmx.com> writes:
On Friday, September 13, 2013 22:04:24 Anton Alexeev wrote:
 I have a method in a D program which I want to call from a Java
 program. What is the best way to do this?
Usually, to have two languages talk to each other, you have to have a C layer in between. So, AFAIK, that's what you have to do, but there may be a better way to handle it in this case that I don't know about. - Jonathan M Davis
Sep 13 2013
prev sibling parent reply Dejan Lekic <dejan.lekic gmail.com> writes:
On Fri, 13 Sep 2013 22:04:24 +0200, Anton Alexeev wrote:

 I have a method in a D program which I want to call from a Java program.
 What is the best way to do this?
What you need is Java JNI: http://en.wikipedia.org/wiki/ Java_Native_Interface . There are many examples how to do this in C or C+ +. It should not be any different in D.
Sep 14 2013
parent reply "Anton Alexeev" <alexanto gmx.de> writes:
I meant that the programs are running. So there is a runnung 
program in D and a running program in Java. What is the best way 
to communicate between them?
Sep 15 2013
next sibling parent "Michael" <pr m1xa.com> writes:
Pipes or sockets
Sep 15 2013
prev sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday, September 15, 2013 14:47:24 Anton Alexeev wrote:
 I meant that the programs are running. So there is a runnung
 program in D and a running program in Java. What is the best way
 to communicate between them?
Have them communicate via sockets just like you'd talk to a program on another machine (except that the IPs will be 127.0.0.1). - Jonathan M Davis
Sep 15 2013