I have problem with JNI, again...
This time my code works... But... not correct on all PC.
I have:
- Jar file -> my prog
- dll file -> with native methods
- another dll file -> with another functions.
On my PC all this files are in ONE folder.
Files code (.java):
// loading library
try {
Runtime.getRuntime().loadLibrary("E140tests");
setText("Library E140tests.dll was loaded correctly.");
} catch (UnsatisfiedLinkError ex) {
// try load with absolute path
setText("Error: E140tests.dll wasn't loaded!");
setErrorFlag(true);
}
E140tests.dll -> second file (compileted in MSVS)
#include "jni.h"
#include "jni_md.h"
#include "Lusbapi.h"
#include "LusbapiTypes.h"
#include "JNITEST2.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: JNITEST2
* Method: ADCinit
* Signature: (LJNITEST2;)V
*/
JNIEXPORT void JNICALL Java_JNITEST2_ADCinit
(JNIEnv* env, jobject, jobject obj) {
...
lusbapi.dll -> third file, with another functions.
#ifndef __LusbapiH__
#define __LusbapiH__
// --------------------------------------------------------------------------
// ---------------------------- COMMON PART ---------------------------------
// --------------------------------------------------------------------------
#include <windows.h>
#include "LusbapiTypes.h"
If I throw my files in system32, all works too.
But. In another PC (xp, 7) my code doesn't works! Doesn't matter: if files(+dll) are in one folder, or if dll files are in system32 -> code can't find them.
I thought, that problem is in Runtime Libraries (MSVS), but wenn I installed them, nothing has changed...
(on my PC are IntelijIDEA, MSVS, jdk7.xx -> all works. I tested prog on another PC (with MSVS installed) -> and all worked. But on another -> dll wasn't found (and with Runtime Libraries installed too)).
i'll be waiting for help)