|
-
April 18th, 2008, 09:28 AM
#1
Communication between Java and C++
Hi All.
I am working on a project in which two machines are used. One machine is used as front-end machine, the other is used as back-end machine.
The front-end machine is responsible to receive data from the user and to forward the data to the backend machine. The backend machine is responsible to processing the data and return the result to the frontend machine. In turn , the frontend machine forwards the result to the user.
Both the frontend and backend machines run Linux. The data processing program (a legency system) on the backend machine is writtern in C++.
Moreover, to facilitate the data submission, the system allows the user to visit a web page on the frontend in order to fill out and submit a form to the frontend machine. To implement this goal, currently i am going to use JSP to create a web page to collect data from the user and accordingly use Java/JavaBean to move data to and from the backend machine.
However, i am not sure whether the above idea is correct or not. If it is feasible, then how to implement the communication between C++ (programming langauge used in backend machine) and Java (programming language used in frontend machine). Or, I should use C++ in the frontend machine too. Or I should use web service technology in the frontend.
Or SOCKET technology?
I would appreciate any help here
Last edited by cy163; April 18th, 2008 at 09:44 AM.
-
April 18th, 2008, 09:33 AM
#2
Re: Communication between Java and C++
A quick search on Google found many examples of how to access C++ code within Java. There is a package called JNI that allows such interaction.
-
April 18th, 2008, 01:51 PM
#3
Re: Communication between Java and C++
If the front-end machine is just forwarding data to the back-end machine, the simplest solution would be to use a language-neutral data format for the exchange (e.g. XML messaging). This way the front-end and back-end would be decoupled in terms of langage.
We are all shaped by the tools we use, in particular: the formalisms we use shape our thinking habits, for better or for worse, and that means that we have to be very careful in the choice of what we learn and teach, for unlearning is not really possible...
E. Dijkstra
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
-
April 19th, 2008, 08:34 AM
#4
Re: Communication between Java and C++
 Originally Posted by dlorde
If the front-end machine is just forwarding data to the back-end machine, the simplest solution would be to use a language-neutral data format for the exchange (e.g. XML messaging). This way the front-end and back-end would be decoupled in terms of langage.
We are all shaped by the tools we use, in particular: the formalisms we use shape our thinking habits, for better or for worse, and that means that we have to be very careful in the choice of what we learn and teach, for unlearning is not really possible...
E. Dijkstra
Thanks for your posting. Using xml as data format can save much effort translating between data in different format. However, could you suggest me appropriate method for moving the data to and from front- and back-end machine. Someone told me to use SOCKET technique. Is SOCKET feasible for this scenario. Or there is better method.
-
April 19th, 2008, 08:46 AM
#5
Re: Communication between Java and C++
Sockets would be good - have a read of this description: About Sockets, and decide if they suit what you want to do.
A complex system that works in invariably found to have evolved from a simple system that worked...
J. Gall
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|