JNI Callback Problem : C++(exe) > Java(jvm.dll) > C++(exe)

Discussion in 'Java' started by davidb, Aug 30, 2006.

  1. davidb

    davidb Guest

    Hi,
    i have a Callback problem and need some concepts to solve this.
    In my C++ MFC Windows Applikation i create a JVM. From C++ i call a
    method that starts a java process (Sending several server request's).
    This process has several states i want to know in my C++ App. The
    Problem is, how do i get back that Information into my C++ App ?
    I know it is possible to Run a Java App an Call functions of a C++ DLL.
    I also know how to Create a C++ app, Invoke a JVM an Call some java
    Functions. But is it possible to Create a C++ App, Invoke the JVM, an
    get access to my C++ Application Handle to call some C++ functions ?
    Now i've done some tricky stuff in writing my Java Response (int from 0
    to 5) to a File an Frequently Read this File from C++ to see if
    something changed. Thats ..... ugly.
    Another Way i have not try'ed yet is to save that value in a Java Class
    and Frequently Call a getResponseCode() from C++ to get that value. I
    realy dont like this BruteForce Style of getting that Value !
    Any Ideas ?

    best Regards,
    Dave

    Summary:

    C++(exe) calls Java(jvm.dll) Function

    Java(jvm.dll) Calls back C++(exe). // How to ?
    davidb, Aug 30, 2006
    #1
    1. Advertising

  2. On 30 Aug 2006 05:39:28 -0700, davidb wrote:
    > Summary:
    >
    > C++(exe) calls Java(jvm.dll) Function
    >
    > Java(jvm.dll) Calls back C++(exe). // How to ?


    Declare one or more native methods in an appropriate Java class.
    Implement those methods in the C++ exe. Use RegisterNatives() to
    associate them with their class. Invoke them from the Java application
    like any other methods.

    /gordon

    --
    [ don't email me support questions or followups ]
    g o r d o n + n e w s @ b a l d e r 1 3 . s e
    Gordon Beaton, Aug 30, 2006
    #2
    1. Advertising

  3. davidb

    davidb Guest

    Thank you, thats what i was looking for !

    Gordon Beaton schrieb:

    > On 30 Aug 2006 05:39:28 -0700, davidb wrote:
    > > Summary:
    > >
    > > C++(exe) calls Java(jvm.dll) Function
    > >
    > > Java(jvm.dll) Calls back C++(exe). // How to ?

    >
    > Declare one or more native methods in an appropriate Java class.
    > Implement those methods in the C++ exe. Use RegisterNatives() to
    > associate them with their class. Invoke them from the Java application
    > like any other methods.
    >
    > /gordon
    >
    > --
    > [ don't email me support questions or followups ]
    > g o r d o n + n e w s @ b a l d e r 1 3 . s e
    davidb, Aug 30, 2006
    #3
    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.
Similar Threads
  1. Doug Trammell

    JNI Access Violation in jvm.dll

    Doug Trammell, Mar 4, 2004, in forum: Java
    Replies:
    5
    Views:
    8,151
    Chris Uppal
    Mar 5, 2004
  2. vasanth
    Replies:
    0
    Views:
    2,682
    vasanth
    Jan 25, 2005
  3. vasanth
    Replies:
    0
    Views:
    618
    vasanth
    Jan 25, 2005
  4. Naresh Agarwal

    jvm.dll vs java.dll

    Naresh Agarwal, Jun 14, 2005, in forum: Java
    Replies:
    5
    Views:
    3,805
  5. Elena
    Replies:
    8
    Views:
    3,354
Loading...

Share This Page