W3C home > Mailing lists > Public > www-jigsaw@w3.org > November to December 2002

[www-jigsaw] <none>

From: Bhargavi <b.shukla@decisioncraft.com>
Date: Wed, 13 Nov 2002 06:41:21 -0500 (EST)
Message-ID: <001001c28b0a$48f477b0$0400a8c0@bhargavi>
To: <www-jigsaw@w3.org>
Hi

I am calling mydll.dll which is created in VC++ simple Dll, in JAVA. I am getting Java.Lang.UnSatisfiedLinkError exception. 
Can you guide me on this???

Here my Java Code ::

public class myclass

{
 public native void mydll(String msg);
 static 
 {

  System.loadLibrary("mydll");
 }
 public static void main(String args[])
 {
 myclass mc = new myclass();
 System.out.println("before");
 mc.mydll("hello");
  System.out.println("After");
 }
}

I have compiled myclass.java. Then javah -jni myclass to produce myclass.h file.

Here my VC++ code :

#include "stdafx.h"
#include <c:\jdk1.3\include\jni.h>
#include <stdio.h>
#include "c:\tryal\myclass.h"


BOOL APIENTRY DllMain( HANDLE hModule, 
                       DWORD  ul_reason_for_call, 
                       LPVOID lpReserved
      )
{
    return TRUE;
}


extern "C" JNIEXPORT void JNICALL 
Java_ShowMessage_ShowMessage(JNIEnv* env, 
jobject, jstring jMsg) {
  const char* msg=env->GetStringUTFChars(jMsg,0);
  printf("Thinking in Java, JNI: %s\n", msg);
  env->ReleaseStringUTFChars(jMsg, msg);
}


I could compile entire dll. Copied dll at  Winnt\system32 on my machine.

then i typed following at dos prompt :
 
java myclass

This gave me  : 
Exception in thread "main" java.lang.UnsatisfiedLinkError: mydll
        at myclass.mydll(Native Method)
        at myclass.main(myclass.java:14)

Can u pls solve this??

thanks

Bhargavi
Received on Wednesday, 13 November 2002 13:06:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:36 GMT