Java application on Windows calls native app on Sun?

Discussion in 'Java' started by Paul Lee, Jul 31, 2003.

  1. Paul Lee

    Paul Lee Guest

    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
     
    Paul Lee, Jul 31, 2003
    #1
    1. Advertising

  2. Paul Lee

    Andy Fish Guest

    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

    "Paul Lee" <> wrote in message
    news:...
    > 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
     
    Andy Fish, Jul 31, 2003
    #2
    1. Advertising

  3. Paul Lee

    Paul Lee Guest

    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
     
    Paul Lee, Jul 31, 2003
    #3
  4. On 31 Jul 2003 15:22:08 -0700, (Paul Lee) wrote:

    > 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
     
    Joseph Millar, Aug 1, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page