JNI: How do I implement a call back from Java to native "dll"
843829Apr 4 2003 — edited Apr 17 2003Hi Gurus,
I would like to do the call back from the java side to the native side.
The way I do is I have the native "dll" that invoke the java method which would inturn call back the same "dll" when there is an event occurs.
I did that by creating the java native call back method in the java side that would load the dll and call back native function. I m using jdk1.4 and VC++.
But I found that when the Java method call back the native function the JVM crashes with long list of errors. Pls help... I don't know what I m doing is legal operation for JVM.. that is... loading the same dll that invokes the JVM.
Error List that I got:
Current Java thread:
at dds.notification.NativeNotificationListener.notifyNative(Native Meth
d)
at dds.notification.NativeNotificationListener.notify(NativeNotificatio
Listener.java:33)
at dds.notification.NotificationService.run(NotificationService.java:10
)
Dynamic libraries:
0x00400000 - 0x00576000 E:\DDSproject\DDSImplementation\ddscpp\dds\Debu
\subscription.exe
0x77F50000 - 0x77FF9000 C:\WINDOWS\System32\ntdll.dll
0x77E60000 - 0x77F45000 C:\WINDOWS\system32\kernel32.dll
0x6D330000 - 0x6D442000 C:\JAVA\j2sdk1.4.0\jre\bin\client\jvm.dll
0x77D40000 - 0x77DC6000 C:\WINDOWS\system32\USER32.dll
0x77C70000 - 0x77CB0000 C:\WINDOWS\system32\GDI32.dll
0x77DD0000 - 0x77E5B000 C:\WINDOWS\system32\ADVAPI32.dll
0x78000000 - 0x7806E000 C:\WINDOWS\system32\RPCRT4.dll
0x76B40000 - 0x76B6C000 C:\WINDOWS\System32\WINMM.dll
0x77C10000 - 0x77C63000 C:\WINDOWS\system32\MSVCRT.dll
0x73000000 - 0x73023000 C:\WINDOWS\System32\WINSPOOL.DRV
0x763B0000 - 0x763F5000 C:\WINDOWS\system32\comdlg32.dll
0x772D0000 - 0x77333000 C:\WINDOWS\system32\SHLWAPI.dll
0x77340000 - 0x773CB000 C:\WINDOWS\system32\COMCTL32.dll
0x773D0000 - 0x77BC4000 C:\WINDOWS\system32\SHELL32.dll
0x771B0000 - 0x772CA000 C:\WINDOWS\system32\ole32.dll
0x77120000 - 0x771AB000 C:\WINDOWS\system32\OLEAUT32.dll
0x74C80000 - 0x74CAC000 C:\WINDOWS\System32\OLEACC.dll
0x76080000 - 0x760E1000 C:\WINDOWS\System32\MSVCP60.dll
0x71950000 - 0x71A34000 C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-
ontrols_6595b64144ccf1df_6.0.10.0_x-ww_f7fb5805\comctl32.dll
0x6D1D0000 - 0x6D1D7000 C:\JAVA\j2sdk1.4.0\jre\bin\hpi.dll
0x6D300000 - 0x6D30D000 C:\JAVA\j2sdk1.4.0\jre\bin\verify.dll
0x6D210000 - 0x6D228000 C:\JAVA\j2sdk1.4.0\jre\bin\java.dll
0x6D320000 - 0x6D32D000 C:\JAVA\j2sdk1.4.0\jre\bin\zip.dll
0x10000000 - 0x10186000 E:\DDSproject\DDSImplementation\ddscpp\dds\Debu
\dds.dll
0x6D2D0000 - 0x6D2DD000 C:\JAVA\j2sdk1.4.0\jre\bin\net.dll
0x71AD0000 - 0x71AD8000 C:\WINDOWS\System32\WSOCK32.dll
0x71AB0000 - 0x71AC5000 C:\WINDOWS\System32\WS2_32.dll
0x71AA0000 - 0x71AA8000 C:\WINDOWS\System32\WS2HELP.dll
0x011C0000 - 0x011F2000 C:\PROGRA~1\NEWDOT~1\NEWDOT~2.DLL
0x63000000 - 0x63094000 C:\WINDOWS\system32\WININET.dll
0x762C0000 - 0x76348000 C:\WINDOWS\system32\CRYPT32.dll
0x762A0000 - 0x762AF000 C:\WINDOWS\system32\MSASN1.dll
0x71A50000 - 0x71A8B000 C:\WINDOWS\system32\mswsock.dll
0x71A90000 - 0x71A98000 C:\WINDOWS\System32\wshtcpip.dll
0x76C90000 - 0x76CB2000 C:\WINDOWS\system32\imagehlp.dll
0x6D510000 - 0x6D58C000 C:\WINDOWS\system32\DBGHELP.dll
0x77C00000 - 0x77C07000 C:\WINDOWS\system32\VERSION.dll
0x76BF0000 - 0x76BFB000 C:\WINDOWS\System32\PSAPI.DLL
Local Time = Fri Apr 04 13:35:05 2003
Elapsed Time = 8
#
# HotSpot Virtual Machine Error : EXCEPTION_ACCESS_VIOLATION
# Error ID : 4F530E43505002D3
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Client VM (1.4.0-b92 mixed mode)
#
# An error report file has been saved as hs_err_pid1732.log.
# Please refer to the file for further information.
#
thanks in advance.
chancellor