Hello all.
I'm using Eclipse 3.4.0 on Windows and getting the following error when trying to call a function from a dll which is located in the java project(Test) folder:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Test.hello()V
at Test.hello(Native Method)
at Test.main(Test.java:12)
Any thoughts about why this problem is happening will be very appreciated.
This is my simple code:
Test.java
public class Test {
public native void hello();
static {
System.loadLibrary("hello");
}
public static void main(String[] args) {
new Test().hello();
}
}
test.cpp
#include <iostream>
#include "Test.h"
JNIEXPORT void JNICALL Java_Test_hello
(JNIEnv *env, jobject obj)
{
std::cout<<"Hello World!"<<std::endl;
}
Test.h
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Test */
#ifndef _Included_Test
#define _Included_Test
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: Test
* Method: hello
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_Test_hello
(JNIEnv *, jobject);
#ifdef __cplusplus
}
#endif
#endif