Solved: java.lang.UnsatisfiedLinkError: no hello in java.library.path

When we were developing the JNI example as mentioned in our another post, “Java Native Interface ( JNI ) Example , Calling Native C functions from JAVA” we got an error “Exception in thread “main” java.lang.UnsatisfiedLinkError: no hello in java.library.path” as below,

Exception in thread "main" java.lang.UnsatisfiedLinkError: no hello in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
	at java.lang.Runtime.loadLibrary0(Runtime.java:871)
	at java.lang.System.loadLibrary(System.java:1124)
	at HelloWorld.<clinit>(HelloWorld.java:4)
	at Main.main(Main.java:4)

Solution :

This error can be solved by adding the PATH of the native shared library using LD_LIBRARY_PATH as,

$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD

execute this command from the directory where you are trying to execute the JNI example. i.e. the directory where you have created shared library OR you can replace $PWD with the complete path to directory with shared library.

Related :   How to develop first android Application/App in Android Studio ?

Now we can check the LD_LIBRARY_PATH as,

$ echo $LD_LIBRARY_PATH
:/home/devlab/Desktop/jni

Now, if you execute the JNI application, you will not see the error.


lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded