Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JVM error on JNI method call  RSS feed

 
Michael Michse
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody,

i created a java program with a corresponding wrapper called Connector.dll in c++.
when i put the Connector.dll in the jre/bin folder, everything works perfect, but if i put the wrapper dll in the folder from where i start the program (eg c:\test) the jvm crashes with this error (does not matter if i set the -Djava.library.path to c:\test also):

Stack: [0x00990000,0x009e0000], sp=0x009dfa3c, free space=318k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [kernel32.dll+0x12aeb]
C [mscorwks.dll+0x6a91c]
C [mscorwks.dll+0xc9e44]
C [mscorwks.dll+0x196135]
C [mscoree.dll+0x171f8]
C [mscoree.dll+0x1a1fe]
C [mscoree.dll+0xb2dc]
j de.Connector.open(Z)V+0
j de.Connector.<init>(Z)V+6
j de.Connector.getInstance(Z)Lde/Connector;+73
j de.DataController.<init>()V+31
j de.Plugin.<init>(Lde/Router;)V+15
j de.PluginController.main([Ljava/lang/String;)V+20
v ~StubRoutines::call_stub

i load the dll with System.loadLibrary. this works without any problem, also in c:\test

hope you can help me
 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Silence,

please read your private messages.

Rob
 
Michael Michse
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody,

i created a java program with a corresponding wrapper called Connector.dll in c++.
when i put the Connector.dll in the jre/bin folder, everything works perfect, but if i put the wrapper dll in the folder from where i start the program (eg c:\test) the jvm crashes with this error (does not matter if i set the -Djava.library.path to c:\test also):



i load the dll with System.loadLibrary. this works without any problem, also in c:\test

hope you can help me
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, well, the most likely thing is simply that there's a bug in your native code. It's not at all surprising that a stray-pointer or other uninitialized data error would manifest differently depending on where the library is loaded from. There are many, many things that can go wrong in native code. First, are you checking for errors after every call to the JNI APIs?
 
Michael Michse
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tahnk you for your quick response
yes, i always have an exception handler around every jni call. also if i left the method empty in my c++ implementation, i got the error:/ but only if i put the dll in the c:\test folder where the jar is in. if i put the dll in jre/bin, everything works perfect
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!