Need to communicate with JVM for C++ app.
3 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rick_Cheney
Posted On:   Thursday, February 14, 2002 07:38 AM

I am writing a program in C++. It needs to launch a java application and then send and recieve data from that app.


It seems to be the opposite of JNI.

Any ideas?

Re: Need to communicate with JVM for C++ app.

Posted By:   Alexander_Krapf  
Posted On:   Thursday, March 14, 2002 03:06 PM

Rick,


Try using our JunC++ion tool which was designed with exactly this usecase in mind. It takes Java classes as input and generates C++ proxy classes that can be used just like the underlying Java classes.


Here's a C++ program for you:



#include
using namespace std;
#include "java_lang_pkg.h"

int main()
{
String test = "this is a test";

cout << test.toUppercase() << endl;

return 0;
}

You can find out more about JunC++ion at www.codemesh.com.


Good luck,


Alex

Re: Need to communicate with JVM for C++ app.

Posted By:   Alon_P  
Posted On:   Saturday, February 23, 2002 02:18 AM

Part of the JNI API, called the Invocation API, allows you to start a Java VM and run a class on it from C code. I'm not sure about communication with the java class after running it, but have a look at the JNI guide which comes the J2SE docs. It should give you a good start.

Re: Need to communicate with JVM for C++ app.

Posted By:   Rasto_Amrich  
Posted On:   Thursday, February 14, 2002 07:59 AM

Try to use CORBA, it's designated just for this kind of problem... Hope it helps...
About | Sitemap | Contact