Skip to main content
gamedev.net
🔒 Locked

Java JNI Error

Started by Mr_Ridd Mar 22, 2004 at 11:48 PM 0 replies 200+ views
Original Post
Mr_Ridd
Mr_Ridd
Howzit I''ve written a Java file and C++ file just as it is in the tutorial and I still get an error. java.lang.UnsatisfiedLinkError: runNative at Native.runNative(Native Method) at TestNative.main(TestNative.java:14) Exception in thread "main" It''s finding the dll but not the method. I''m using Dev-C++ to make the dll. Heres the code: Java class: public class Native { public native void runNative(); } header file: /* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class Native */ #ifndef _Included_Native #define _Included_Native #ifdef __cplusplus extern "C" { #endif /* * Class: Native * Method: runNative * Signature: ()V */ JNIEXPORT void JNICALL Java_Native_runNative (JNIEnv *, jobject); #ifdef __cplusplus } #endif #endif C++ file: #include <jni.h> #include "Native.h" #include <stdio.h> JNIEXPORT void JNICALL Java_Native_runNative(JNIEnv* env, jobject thiObj) { printf("Native method executed successfully!!!"); } implementing class: public class TestNative { static { System.out.println("Loading..."); System.loadLibrary("native"); System.out.println("Loaded!"); } public static void main(String[] ar) { Native nat = new Native(); nat.runNative(); } } Shot
The ability to succeed is the ability to adapt

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.