jvm.dll file path & placement of class files for jni

Hi, Java programmer here. I am programming a java wrapper for a c++ program. So because of hardware migration, I am supposed to de-hardcode some stuff like below:
 
HINSTANCE hinstlib = LoadLibrary(TEXT("C:\\Program Files\\Java\\jre1.5.0_22\\bin\\client\\jvm.dll)); 

I am trying to change it to
1
2
char * path = strcat(getenv("JAVA_HOME"), "\\bin\\client\\jvm.dll");
HINSTANCE hinstlib = LoadLibraryA(path);

but I am still getting errors of not able to find the jvm.dll even though the path is correct! Can anyone help?

Secondly, after compiling the executable file, I would like to debug it via my VS2010 IDE but the debugger complains the java class file is missing. However I am able to run the executable by double clicking the compiled EXE file. Is there any setting to be set in the IDE to enable it to find my java class file for jni?
Last edited on
It's not safe to modify the string returned by getenv.
Topic archived. No new replies allowed.