Is it possible to write an application in C++, and enable this application to be
used by Java as a component such as MS COM?
Luc The Perverse - 13 Aug 2006 19:17 GMT
> Is it possible to write an application in C++, and enable this application
> to be used by Java as a component such as MS COM?
Interfacing C++ and Java is possible using JNI (but does destroy system
interoperability)
Are you sure that you mean application? Typically one application would
use components, or classes or functions. If you are writing two seperate
applications then all you need to do is find a way for them to communicate.
Incidentally, I originally came to this group asking the same question - and
I eventually found that all the reasons that I wanted to use C++ from in
Java were really not necessary - and soon thereafter Java became my favorite
language. (I still struggle with a few n00bish things, but I feel I am
fairly strong in the basics now.)
In the case of an existing library (a DLL if you are on windows), JNI
suddenly makes a lot of sense. Or if you need to do things which are not
possible from Java, then you must use JNI (although be ready, JDK 1.6 is
addressing many of the most common missing components including manipulating
desktops, and utilizing system trays which were of principal interest to me)
--
LTP
:)
Jean-Francois Briere - 13 Aug 2006 20:46 GMT
> Is it possible to write an application in C++, and enable this application to be
> used by Java as a component such as MS COM?
If you build a DLL with exposed COM objects you can access them with a
Java COM bridge.
There are some bridges available, some free, some not free.
My favorite bridge is free and is called JACOB:
http://sourceforge.net/projects/jacob-project/
Regards
Arne Vajhøj - 13 Aug 2006 20:59 GMT
> Is it possible to write an application in C++, and enable this application to be
> used by Java as a component such as MS COM?
The 10 year old MS Java actually has COM support builtin.
For a non-antique standard compliant Java you will need
to either get a product like:
http://danadler.com/jacob/
http://www.alphaworks.ibm.com/tech/dtjcb
or write it yourself using JNI.
Consider using either a proprietary
protocol over plain sockets or standard
SOAP/HTTP.
Arne
Greg R. Broderick - 13 Aug 2006 22:31 GMT
> Is it possible to write an application in C++, and enable this
> application to be used by Java as a component such as MS COM?
If you're thinking of using a COM control as a UI component in a Java
application, then I doubt it would play well with awt, swing or spring.
Otherwise, sure - see the advice that others have given.
Cheers
GRB

Signature
---------------------------------------------------------------------
Greg R. Broderick gregb.usenet200607@blackholio.dyndns.org
A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------