Reputation: 2896
I am running my first program in ubuntu.
But there was an error when I tried to run it:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no foo in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1681)
at java.lang.Runtime.loadLibrary0(Runtime.java:840)
at java.lang.System.loadLibrary(System.java:1047)
at JNIFoo.<clinit>(JNIFoo.java:6)
Could not find the main class: JNIFoo. Program will exit.
Upvotes: 1
Views: 298
Reputation: 4489
These lines taken from Getting Stated JNI from SUN site
Make sure that the native library resides in one of the directories in the native library path. If you are running on a Solaris system, the LD_LIBRARY_PATH environment variable is used to define the native library path. Make sure that it includes the name of the directory that contains the libHelloWorld.so file. If the libHelloWorld.so file is in the current directory, you can issue the following two commands in the standard shell (sh) or KornShell (ksh) to set up the
LD_LIBRARY_PATH
environment variable properly:LD_LIBRARY_PATH=. export LD_LIBRARY_PATH
Upvotes: 2
Reputation: 6588
Exception in thread "main" java.lang.UnsatisfiedLinkError: no foo in java.library.path
Fix your library path and try again.
Upvotes: 1