Java Native Interface (JNI) - can't load jvm.dll
the following simple code can't load jvm.dll
at windows xp sp2 ,
jre-1_5_0_11
#include <jni.h>
#include <stdio.h>
int main() {
HINSTANCE hVM;
if((hVM = LoadLibray("C:
Program Files\\Java\\jre1.5.0_11\\bin\clien
jvm.dll"))==NULL){
printf("faild\n");
}
else
printf("succes\n");
return 0;
}
[421 byte] By [
eldessokya] at [2007-11-26 23:04:59]

# 3
Hmm do you know about Copy+Paste BTW?
As I can see you type your code here manually? :) There are errors... LoadLibray - there is no such function; "bin\clien" - should it be "bin\client"?; GetLatError - GetLastError...
Well, first of all post your actual code to ensure you use correct path not "clien"...
# 4
#include <iostream>
#include <stdlib.h>
#include <windows.h>
using namespace std;
int main(int argc, char *argv[])
{
HINSTANCE hVM;
char *path="C:
Program Files\\Java\\jre1.5.0_11\\bin\client
jvm.dll";
if((hVM = LoadLibrary(path))==NULL){
printf("Error : %d\n",GetLastError());
}
else{
printf("succes\n");
FreeLibrary(hVM);
}
return 0;
}
# 5
Well, as I can see you use wrong path and forgot one slash:
char *path="C:<br clear="all" />Program Files\\Java\\jre1.5.0_11\\bin\client<br clear="all" />jvm.dll"; // nowchar *path="C:<br clear="all" />Program Files\\Java\\jre1.5.0_11\\bin\\client<br clear="all" />jvm.dll"; // should be
Correct and check again.