Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

VC++ calling Java code  RSS feed

 
Sandeep Advani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to have a VC++ code calling a Java interface to do some work. Now does this Java application need to be based on an EJB architecture to be used by VC++ IDE ? I know that can be done through CORBA but how does a Java application based on EJB architecture be called by VC++ code, if at all it works that way. Could you also direct me to any link or technologies which talks about it ?
Thanks
Sandeep
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hate giving incomplete answers, BUT you can implement EJB using IIOP instead of JRP. (IIOP is Corba -- roughly translated). How exactly you do that I have no idea.
 
Dana Hanna
Ranch Hand
Posts: 227
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd use JMS with MQSeries or MSMQ. But CORBA/IIOP would also work.
The better question is Why do you need to mix? Which can be re-written?
 
Sandeep Advani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dana,
You are right, the Java code can be re-written in VC++. But the whole idea will be the time and resources spent on re-writing this massive application. More than that, I have never worked on VC++. Its been all Java most of the time.
You said JMS; does that mean that I must make this application based on EJB architecture first? Once I get this functionality encapsulated within the bean, how do I register this with the Windows in order for VC++ to call it ? Any further directions will be appreciated !
Sandeep
 
Paul Smiley
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Someone mentioned JIntegra. It is a good, quick solution but a) it can be expensive and b) you are tied to a proprietary solution. It might be OK for an internal app, but I wouldn't suggest it for a customer app.
 
Kripal Singh
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you are trying to do here is invoke the JVM from a c/c++ program (native code). I think it is possible to do that. You don�t have to write the EJB or something. Just write the java class with main function and try invoking the jvm from your c/c++ code and pass the java class as your parameter.
See this code
http://java.sun.com/docs/books/tutorial/native1.1/invoking/example-1dot1/invoke.c
And this discussion
http://forum.java.sun.com/thread.jsp?forum=52&thread=485999&tstart=135&trange=15
see this JNI tutorial
http://java.sun.com/docs/books/tutorial/native1.1/invoking/index.html
Another method will be to write a COM wrapper on top of your java program and make you c++ program as the COM client
[ March 17, 2004: Message edited by: Kripal Singh ]
 
Kyle Brown
author
Ranch Hand
Posts: 3892
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two words -- Web Services. Go read about how to publish your EJB's as Web Services in J2EE (perhaps using Richard Monson-Haefel's excellent book on J2EE web services) and then go learn how to invoke Web Services from .NET.
Kyle
 
Sandeep Advani
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone to give me a start. This should keep me busy to look into quality stuff as mentioned by Kripal and Kyle. Thanks a lot guys !
I will post my experience once I get through this.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!