4

I'm trying to use JNI in a C++ application.
I include jni.h and tried calling JNI_CreateJavaVM but I keep getting:
"Unresolved external error" about this function.
I Linked to:
"C:\Program Files\Java\jdk1.7.0\lib\jvm.lib"
"C:\Program Files\Java\jdk1.7.0\lib\jawt.lib"

but it didn't help.
What am I missing?

Idov
  • 5,006
  • 17
  • 69
  • 106
  • You are linking to the correct libraries. Is the error a linker error that says: `Unresolved external symbol _JNI_CreateJavaVM` (note the leading _)? if it is then you could be missing `__stdcall` from your declaration: check to make sure `jni_md.h` is included from `jdk1.7.0\include\win32`. – tribeca Jan 02 '12 at 16:03
  • The exact error is : unresolved external symbol __imp__JNI_CreateJavaVM@12 referenced in function ... – Idov Jan 02 '12 at 18:30

1 Answers1

3

Got it!
I was trying to link my 32bit application with 64bit java libraries.
Downloading the 32bit JDK and linking to that solved the problem :)

Idov
  • 5,006
  • 17
  • 69
  • 106