Eclipse exported Runnable Jar fails througing java.lang.UnsatisfiedLinkError exception

alaa_sayegh

This problem is a famous one and there are many similar questions but no solution helped me. So please, don't mark my question as duplicate.

I developed a small application in Java that uses external dlls. Everything seems to be working fine in eclipse but once I export to runnable jar and run using java -jar myapplication.jar, it throws the following exception:

Exception in thread "main" java.lang.UnsatisfiedLinkError: Testing.dal.LoggingAccess.__LoggingAccess0(Lnet/sf/jni4net/inj/IClrProxy;Ljava/lang/String;)V
        at Testing.dal.LoggingAccess.__LoggingAccess0(Native Method)
        at Testing.dal.LoggingAccess.<init>(LoggingAccess.java:25)
        at Program.listItems(Program.java:32)
        at Program.main(Program.java:27)

I have tried to do almost all what is suggested in other answers but unfortunately nothing worked for me. I tried to set java.library.path, but I don't know if i'm doing it correctly. I'm not a java developer and java world is totally new to me. So I may be doing it in the wrong way. It would be great if you can give me any hint on how to solve this.

alaa_sayegh

I was able to solve this problem myself.

The needed library was in the correct place but I had to reference it in the java project. The problem is that i don't want to play around with Path (environment variables) or copy the libraries to the system32 folder as suggested in many posts. Thats why i added System.Laod(new java.io.File("path to the dll").getAbsolutePath()) at the beginning of the main method.

Many recommended to mention the library name without .dll extension, but for me it worked only with .dll. Moreover, I had to load not only the needed library but also all the libraries that my library depends on. For example: my library depends on EntityFramework.dll, so i had to include this line in the main method:

System.load(new java.io.File("path/EntityFramework.dll").getAbsolutePath());

After exporting the project into a runnable jar file and tested from the cmd with statement java -jar exported-file.jar, I was then able to see the outputs correctly in the console. I just posted this answer in case someone is facing such an error and searching a solution.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Java eclipse error with exported runnable jar file

From Dev

Exported eclipse runnable .jar will not run

From Dev

Java project working on Eclipse but not working when exported to runnable jar file

From Dev

UnsatisfiedLinkError in exported (Eclipse) executable jar file

From Dev

Eclipse exported Runnable JAR not showing images

From Dev

eclipse: java.lang.UnsatisfiedLinkError

From Dev

Java - program works perfectly in eclipse but does not seem to do its intended task when exported to runnable jar

From Dev

Spring running external JUnit Jar causes java.lang.Exception: No runnable methods

From Dev

Different behavior in JAR file vs Runnable JAR file exported from Eclipse

From Dev

Exception Ljava/lang/UnsatisfiedLinkError

From Dev

java.lang.UnsatisfiedLinkError exception when using TESSERACT API in Java

From Dev

Eclipse export to runnable .jar

From Java

java.lang.Exception: No runnable methods exception in running JUnits

From Dev

Exporting a runnable jar, opening it returns an UnsatisfiedLinkError

From Dev

FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError in Android Studio library

From Dev

Exception in thread "main" java.lang.UnsatisfiedLinkError 3

From Dev

ECLIPSE - java.lang.UnsatisfiedLinkError while working with JNI

From Dev

java Runnable - Exception in thread "main" java.lang.NoClassDefFoundError

From Dev

Java project runs properly in command line (exported jar), but not using Eclipse

From Dev

Eclipse Java9 Export Runnable JAR file

From Dev

OpenCV Exporting Runnable JAR in Eclipse

From Dev

Java creating runnable .jar

From Dev

Java Runnable Jar IllegalArgumentException

From Dev

Exception in thread "main" java.lang.UnsatisfiedLinkError: no libopencv_java247 in java.library.path

From Dev

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path

From Dev

OpenCV java.lang.UnsatisfiedLinkError

From Dev

JNI java.lang.UnsatisfiedLinkError

From Dev

JavaFX Project breaks when exported to runnable .jar? FXMLLoader related?

From Dev

DynamicReports won't work when exported to a runnable jar

Related Related

  1. 1

    Java eclipse error with exported runnable jar file

  2. 2

    Exported eclipse runnable .jar will not run

  3. 3

    Java project working on Eclipse but not working when exported to runnable jar file

  4. 4

    UnsatisfiedLinkError in exported (Eclipse) executable jar file

  5. 5

    Eclipse exported Runnable JAR not showing images

  6. 6

    eclipse: java.lang.UnsatisfiedLinkError

  7. 7

    Java - program works perfectly in eclipse but does not seem to do its intended task when exported to runnable jar

  8. 8

    Spring running external JUnit Jar causes java.lang.Exception: No runnable methods

  9. 9

    Different behavior in JAR file vs Runnable JAR file exported from Eclipse

  10. 10

    Exception Ljava/lang/UnsatisfiedLinkError

  11. 11

    java.lang.UnsatisfiedLinkError exception when using TESSERACT API in Java

  12. 12

    Eclipse export to runnable .jar

  13. 13

    java.lang.Exception: No runnable methods exception in running JUnits

  14. 14

    Exporting a runnable jar, opening it returns an UnsatisfiedLinkError

  15. 15

    FATAL EXCEPTION: main java.lang.UnsatisfiedLinkError in Android Studio library

  16. 16

    Exception in thread "main" java.lang.UnsatisfiedLinkError 3

  17. 17

    ECLIPSE - java.lang.UnsatisfiedLinkError while working with JNI

  18. 18

    java Runnable - Exception in thread "main" java.lang.NoClassDefFoundError

  19. 19

    Java project runs properly in command line (exported jar), but not using Eclipse

  20. 20

    Eclipse Java9 Export Runnable JAR file

  21. 21

    OpenCV Exporting Runnable JAR in Eclipse

  22. 22

    Java creating runnable .jar

  23. 23

    Java Runnable Jar IllegalArgumentException

  24. 24

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no libopencv_java247 in java.library.path

  25. 25

    Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java2410 in java.library.path

  26. 26

    OpenCV java.lang.UnsatisfiedLinkError

  27. 27

    JNI java.lang.UnsatisfiedLinkError

  28. 28

    JavaFX Project breaks when exported to runnable .jar? FXMLLoader related?

  29. 29

    DynamicReports won't work when exported to a runnable jar

HotTag

Archive