Java application on Windows calls native app on Sun?

P

Paul Lee

Dear everyone,
Just thought I'd drop by and ask a question thats confounding me (yes,
I am a newbie!).
If I had a Java app on Win2k, and wanted to call a remote C++
application on a Sun machine, how would I go about doing this?
I'm guessing that I'd use RMI to allow JVMs to talk across a network
(??)
and then use JNI to get the Sun's JVM to access the Sun Machine's C++
application methods? I don't think we can follow the examples given
for JNI on the Sun website as we don't have the source code for the
app on the Sun, although we have found out that the methods are
exposed, like a COM interface.

I think.
Can anyone help?

Best wishes

Paul
 
A

Andy Fish

RMI is one option, others might be:

soap
corba
http request
dcom (probably not worthwhile unless both are windows)
rpc
some other home grown socket interface

you probably should read up on the relative pros and cons of these. If RMI
is your preferred solution then yes you are right about implementing JNI on
the sun side to call the C++ object.

Andy
 
P

Paul Lee

Hi all,
Thanks for your replies - what I meant when I said "call an
application" was call methods within that application, such as alter
the appearance of the GUI or retrieve data from the app.

The thing that is confounding me is the Sun Java JNI example talks
about interfacing with an C++ app when the source code to that app is
available - in this case, it won't be, although we do have the app's
APIs to hand.

All in all, a bit of a mess!

Best wishes

Paul
 
J

Joseph Millar

Hi all,
Thanks for your replies - what I meant when I said "call an
application" was call methods within that application, such as alter
the appearance of the GUI or retrieve data from the app.

If this application is already up and running, then it has
to provide the communication mechanism.
The thing that is confounding me is the Sun Java JNI example talks
about interfacing with an C++ app when the source code to that app is
available - in this case, it won't be, although we do have the app's
APIs to hand.

What sort of API's? JNI is simple, it allows your executing
Java code to call into code you have written in C or C++ which
is in the form of a dll or shared library. What you do once
you are in C/C++ is entirely up to you. If you want to call
some other API to talk to some external app, have a good time.

So if you're goal is to talk from your Java code to some other
app, you have to first find out what the other app is using
to talk with. Then you need to look at your Java code and
see if Java provides the means to understand that form of
communication. If it does, then you have to look at your
environment and see if that imposes any further restrictions.
For example, if the app provides callable API's and these
API's do their work using shared memory, calling these on
a physically different machine would not work.

It's impossible for us to give you a definitive answer based
on the little (and unclear) information you have provided.

--Joe
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top