Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
davidb - 30 Aug 2006 13:39 GMT
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 ?
Gordon Beaton - 30 Aug 2006 14:16 GMT
> 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

Signature

[ 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 - 30 Aug 2006 14:47 GMT
Thank you, thats what i was looking for !

Gordon Beaton schrieb:

> > Summary:
> >
[quoted text clipped - 12 lines]
> [ 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


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.