Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

JVM Crash within native method

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have a simple Java file that calls a native method implemented in a .cpp file. From within the native method, I wish to get the value of a Java static field (just a hypothetical situation I'm using for my testing purposes). In order to do that, I need to find the Java class within my native method. When I use GetObjectClass, it seems to find the class, but does not find the field or method that I wish to access. When I use FindClass, it doesn't seem to find the class itself. I did some research on it, and found that this problem may be because my jvm.dll in the jre/bin/client directory may not be loaded. Is this true? Why would my FindClass fail if I have my .java, .class, and .cpp files all in the same folder?

Next, I tried to use LoadLibrary(<path to jvm.dll> from within my native method in order to load the jvm.dll file before looking for the java class using FindClass, but when I include the LoadLibrary call in my code and execute the Java program, I get the javaw.exe crash dialog box.

Could anybody please tell me why I'm not being able to tell me why my FindClass is failing, and if the reason is that jvm.dll is not loaded, how/where can I load it?

Thanks.
 
today's feeble attempt to support the empire
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic