Error while running my jar outside of the ide using command line and external lib

430 views Asked by At

I got a programm which is working on my ide (Eclipse Luna Service Release 2 (4.4.2)). Now i want to execute it without Eclipse to be able to run it on others computer.

I exported it from eclipse using export projet into a jar file, a specified this manifest:

Manifest-Version: 1.0
Main-class: RecupPhoto
Class-path: opencv-300.jar

Both files, RecupPhoto.jar and opencv-300.jar are in the same folder, i already checked the java path, the jre and jdk.

My problem is when i execute:

java -jar RecupPhoto.jar

with a .bat file inside the jar folder i got this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no opencv_java300 in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at Ihm.<init>(Ihm.java:89)
    at RecupPhoto.main(RecupPhoto.java:10)

I'm not expert on errors etc but i understand that there is an error with "opencv_java300", but i don't understand this error because i didn't get this import with a "java" in the middle of the name.

Here is the loadlibrary from the error, in case it could help:

System.loadLibrary(org.opencv.core.Core.NATIVE_LIBRARY_NAME);

(core is a package from opencv library).

So any idea/help will be welcome! (and sorry for my poor english)

1

There are 1 answers

0
Neithalf On

I was missing the path to dll in my bat file, new call is:

  java "-Djava.library.path="C:\opencv\build\java\x64 -jar RecupPhoto.jar