wood burning stoves 2.0
The moose likes C / C++ and the fly likes Wrap Java with C Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » C / C++
Bookmark "Wrap Java with C" Watch "Wrap Java with C" New topic

Wrap Java with C

Chris Cody

Joined: Mar 20, 2008
Posts: 2

I am sorry if this is the wrong place or if this question has been repeated too many times.
[I did look and did not find an answer.]
The short version is that I have been instructed to wrap a set of objects and methods in a Jar file from a C based application.
Is this possible, if so what resources exist to do this?

The longer version:
There is a deployment that exists as a set of EJBs on a web server (Weblogic).
There exists a C application (in Solaris Unix) that is required to send information to and retrieve messages from the EJB.
There exists a Jar file containing the interface and stubs in order to connect to the EJB from another EJB or from another Java application.
There does not exist a set of interfaces that are available to the C application.
The "managerial" solution is that the Jar file should be wrapped by the C code and use the Java objects to access the EJB.

Is there a way to get this done, or is there a better way to do it?

My suggestion is to create a Java application that connects natively through the libraries to the EJB and then write a TCP/IP interface between the C application and the Java application.

Any technical advice would be greatly appreciated.
I would also appreciate sage advice about how to tactfully describe the managerial solution as a very bad idea [If it is as bad as it appears to be].

Thank you very much in advance.

Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

I am not sure, if you have C library(s) that can do what you want.

However, on the assumption that it is not there, there is no technical feasibility to wrap Java objects in C code.

Further, you may talk with EJB via CORBA/ORB/IDL technique, a quite cumbersome and complicated approach (without support IDEs etc...).

Not many get the right opportunity !
I agree. Here's the link: http://aspose.com/file-tools
subject: Wrap Java with C
It's not a secret anymore!