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

D

davidb

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 ?
 
G

Gordon Beaton

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
 
D

davidb

Thank you, thats what i was looking for !

Gordon said:
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
 

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,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top