Salve a tutti,
ho un problemi nell'eseguire un semplice programma che utilizza Java JNI. Voglio lanciare un metodo C++ utilizzando Java.
L'errore è java.lang.UnsatisfiedLinkError: Test1.inDll()V
at Test1.inDll(Native Method)
at Test1.main(Test1.java:11)
Allego codice Java
codice:
class Test1
{
    static
    {
        System.loadLibrary("TestDll");
    }
    public static void main(String ar[])
    {
        System.out.println("Hello world from Java");
        Test1 t=new Test1();
        t.inDll();
    }
    public native void inDll();
}
Qui il codice generato con javah -jni Test1 ovvero Test1.h
codice:
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Test1 */

#ifndef _Included_Test1
#define _Included_Test1
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     Test1
 * Method:    inDll
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_Test1_inDll (JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif
e infine l'header file che include quello precedente
codice:
// TestDll.h : file di intestazione principale per la DLL TestDll
//

#pragma once

#ifndef __AFXWIN_H__
	#error "inclusione di 'stdafx.h' del file corrente per PCH"
#endif

#include "resource.h"		// simboli principali
#include "Test1.h"

// CTestDllApp
// Vedere TestDll.cpp per l'implementazione di questa classe
//

class CTestDllApp : public CWinApp
{
public:
	CTestDllApp();

// Override
public:
	virtual BOOL InitInstance();

	DECLARE_MESSAGE_MAP()
};
JNIEXPORT void JNICALL Java_Test1_inDll(JNIEnv *env, jobject obj)
{
	printf("Hello word from C++");
    AfxMessageBox(_T("Hello World from dll"));
};