I have a java/swing interface and C++ processing engine. How I execute C++ program from JAVA ? Right I have shell script in which java compiles C++ and writes the output to a file and JAVA reads it from there. Is there any better and elegant solution ?
How to interface java and C++ ?
JNI isn't strictly necessary here. There are other solutions that might work better for you. One is simply calling the executable from Java -
http://www.rgagnon.com/javadetails/java-...
Another is using XML-RPC. I've taken this route in the past when building processing engines in C++ because the engines stays loaded in memory and doesn't have to reside on the same machine.
From Java -
http://www-128.ibm.com/developerworks/xm...
From C++ -
http://xmlrpc-c.sourceforge.net/
Much of the XML-RPC stuff has been replaced by web services, but XML-RPC is much simpler and is very light weight.
Reply:You'll have to use JNI. It's not easy, but it can be done. Check out the link below for more information. You may need to google for tutorials and further data.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment