java.lang.UnsatisfiedLinkError

My Java Jar packaged code run perfectly on my desktop from commandline. It produced outputs and written to file.

However, when I copied the same Jar file and run it from Commandline on AWS (Windows Server 16) I received the following error. It’s 16 cores so my code is written to query the number of processors at run time and run 16 multithreads of xgboost train/test. Each thread is assigned to a different “nround”, such that thread1 (nround=2), thread2 (nround=3), thread3 (nround=4),…, thread16 (nround=17)…

The Jar (for Windows) I used was downloaded from here: https://github.com/criteo-forks/xgboost-jars/releases


Exception in thread “main” java.lang.UnsatisfiedLinkError: C:\Users\sipal\AppData\Local\Temp\2\xgboost4j5994672742003987150.dll: Can’t find dependent libraries

Does anyone have a tip of what may be wrong here?

In my maven project (MyProject) in the Eclipse Package Explorer which looks like the hierarchy below:

MyProject

src/main/java
src/main/resources
src/test/java
src/test/resources
JRE System Library [JavaSE - 1.8]
Maven Dependencies
Referenced Libraries
target
pom.xml
src

lib

xgboost4j-0.91.0-criteo-20190723-7ba5648_2.11-win64.jar

The “xgboost.dll” file is in ‘lib’ folder, ie, “/lib/xgboost.dll” in the Jar file “xgboost4j-0.91.0-criteo-20190723-7ba5648_2.11-win64.jar” when I decompress it.

When I build MyProject with “Run As” then “Maven Build…” with goals ‘clean install’, it produced the ‘target’ folder as shown below:

target

MyProject

lib
MyProject.jar

The ‘lib’ subfolder under ‘MyProject’ folder contains all the maven dependencies Jar files including the ‘xgboost4j-0.91.0-criteo-20190723-7ba5648_2.11-win64.jar’

The ‘MyProject.jar’ and ‘lib’ (both under the parent ‘MyProject’ folder which is under the target’ folder) is where I CD to and then do the following in my local desktop:

java -cp “MyProject.jar;lib/*” com.riskpricing.RegressionPrediction

which ran perfectly fine. I get the result written to a CSV file.

I copied the parent ‘MyProject’ folder which contains the ‘lib’ and ‘MyProject.jar’ to the desktop folder in Windows 16 Server on AWS.

I did exactly the same thing as I did on my desktop from the commanline. I CD to where ‘MyProject’ is, then:

java -cp “MyProject.jar;lib/*” com.riskpricing.RegressionPrediction

and the java.lang.UnsatisfiedLinkError is thrown.

I have no clue to what is the problem.

Cheers.