1
votes

while trying to run the jni hello world program in eclipse i got the following error

on in thread "main" java.lang.UnsatisfiedLinkError: no HelloWorld 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 HelloWorld.<clinit>(HelloWorld.java:11)

BUT I WORKED PERFECTLY IN COMMAND LINE

can anyone suggest me a solution for this?

1

1 Answers

2
votes

This should happen because when you run your Java program, it cannot find the HelloWorld shared library (.dll, .so... depending on your OS).

Try this to check where the JVM expects you to put the shared library, and place it in one of the directories you see:

System.out.println(System.getProperty("java.library.path"));

Generally, the working directory is a safe choice.