Jump to content
Excelsior Forums
Xyrophile

Loading DLL causes UnsatisfiedLinkError

Recommended Posts

Hello all,

I'm having a bit of a puzzling experience trying to get an app which uses JNI to load the relevant DLL in Jet 7.6. While I'm able to compile just fine, running the compiled exe results in an UnsatisfiedLinkError. The DLL is written in C, and I've never had any problems using it with the Oracle JRE (although that doesn't mean much!)

Apparently the DLL is not visible in the java.library.path. The error also occurs running the original jar with xjava. I load the library with System.loadLibrary, and the DLL is in the same directory as the application - I've tried putting it in a separate directory and adjusting the java.library.path in JETVMPROP, but to no avail.

I've noticed a few posts on similar problems in the forums here, but no solutions. Does anyone have any suggestions?

Output from exe:

JET-compiled Java program has started.

-------------------------------------

Exception in thread "main" java.lang.UnsatisfiedLinkError: no pomoni in java.lib

rary.path

at java.lang.Void.<unknown>(Unknown Source)

at java.lang.Void.<unknown>(Unknown Source)

at java.lang.Void.<unknown>(Unknown Source)

at java.lang.Void.<unknown>(Unknown Source)

-------------------------------------

JET-compiled Java program has exited.

Press any key to continue . . .

Output from xjava:

Exception in thread "main" java.lang.reflect.InvocationTargetException

at java.lang.Void.<unknown>(Unknown Source)

at java.lang.Void.<unknown>(Unknown Source)

at java.lang.Void.<unknown>(Unknown Source)

at java.lang.Void.<unknown>(Unknown Source)

Caused by: java.lang.UnsatisfiedLinkError: no pomoni in java.library.path

... 4 more

Share this post


Link to post
Share on other sites

Hello,

This problem can be caused by 64-bit DLL. It can be loaded by 64-bit Oracle JRE but cannot be loaded by executables compiled with Excelsior JET.

You can check version of used Oracle JRE by running the following command:

java -version

Excelsior JET 7.6 produces 32-bit executables that can't load 64-bit DLLs.

Consider recompiling DLL with 32-bit C compiler.

Share this post


Link to post
Share on other sites

I've been using a 32-bit build of my DLL with Jet, and I've removed the hooks to load the 64-bit version on 64-bit JREs from my code. Unfortunately, this isn't the problem, as I made and tested these changes before my initial compile - eliminating the need to support 64-bit JREs is one of the benefits of Jet for this project. Thank you for the suggestion though!

Share this post


Link to post
Share on other sites

Please run the following small sample on 32-bit Oracle JRE and Excelsior JET.

public class TestLibrary {
   public static void main (String[] args) {
       System.loadLibrary("pomoni");
   }
}

If the problem still appears, please send this DLL to Excelsior Support for further investigation.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×