FIX: MSJAVAH Fatal Error: java.lang.UnsatisfiedLinkError

ID: Q222581


The information in this article applies to:


SYMPTOMS

When running MSJAVAH on a compiled Java class, the following error appears:

Fatal error: java.lang.UnsatisfiedLinkError: no myDLL in shared library path


CAUSE

In the 29xx series of the Microsoft virtual machine (Microsoft VM), MSJAVAH never wants to initialize the specified class. In the 31xx series, it always wants to initialize the specified class if the class contains primitive members that are declared static and final. Under these conditions, the static block containing the System.loadLibrary( ) method is executed and the aforementioned error occurs.


RESOLUTION

You can use one of the following to resolve this problem:


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

This problem was corrected in Microsoft SDK for Java version 3.2 for Windows.


MORE INFORMATION

To reproduce this error, make sure that you are using SDK for Java 3.1 and compile the following source. Then run MSJAVAH on the resulting class file.


public class TestMSJAVAH {
  public native void myNativeMethod();

  // this is the culprit:
  public static final double A=3.1;

  // these work fine:
  public static double B=3.2;
  public final  double C=3.3;

  // and this is OK, too:
  public static final Double D=new Double(3.4);

  static {
    System.loadLibrary("myDLL");
  }

  public static void main(String args[]){
    new TestMSJAVAH().myNativeMethod();
  }
} 

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Joseph B. Hall, Microsoft Corporation

Additional query words: RNI


Keywords          : kbJavaVM kbJNative kbSDKJava kbGrpJava 
Version           : WINDOWS:3.1
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: July 27, 1999