Search code examples
javaeclipsejvmwindows-ce

UnsatisfiedLinkError : Native library 'wcepeer' not found (Mysaifu)


I'm trying to code an application in Java that can be executed in a Windows CE operating system.

For this, I use Eclipse on my Windows PC and then transfer the .jar file into my "smaller" system that operates with Windows CE. The .jar file is then executed with the Mysaifu JVM (because we need a JVM to execute a Java program in Windows CE).

So I started with a simple application that will launch a window (with JFrame) and when I tried to execute it, I got an error message :

java.lang.UnsatisfiedLinkError: Native library 'wcepeer' not found (as file 'wcepeer') in gnu.classpath.boot.library.path and java.library.path

I've tried to verify if the file representing the native library (wcepeer.dll) is in the correct folder, and I could see that the file is there with another library files, for example wcesound.dll, wcesecurity.dll, etc. Normally these files are provided in Program Files/Mysaifu JVM/jre/bin when I installed the JVM on my Windows CE system.

I've also tried to verify the presence of the wcepeer library with System.loadLibrary() :

   try {
       System.loadLibrary("wcepeer");          } catch(UnsatisfiedLinkError e) {
        System.err.println("Native code library failed to load.\n" + e);       }

The result was :

Native code library failed to load. java.lang.UnsatisfiedLinkError: Native library 'wcepeer' not found (as file 'wcepeer') in gnu.classpath.boot.library.path and java.library.path

However when I replaced "wcepeer" with "wcesound" for example, there was no error. So I suppose that there's a problem with the wcepeer.dll file, but I've no idea how to solve it. I searched everywhere on the net, there's only a forum about this but it doesn't help too much.

Thanks in advance for helping.

Kindly regards,


Solution

  • You can use dependency walker (http://www.dependencywalker.com/) to open your DLL (it works also on CE dlls, since they use the same format as Windows ones) and see what dependencies this DLL has. It may be that other DLLs are required (if they are statically linked via export lib your DLL will fail to load anyway) or that the DLL requires some system DLLs or APIs that are not supported on your device. Windows CE is a componentized OS so you may have a different set of APIs, depending on the components you included in the OS image.