tags:

views:

33

answers:

2

Im am trying to use a JNI library but unable to locate where the .so files are on my ubuntu machine?

The reason I need to find it is because I suspect Im using an older version and like to replace it with a newer one.

Its more of an ubuntu question rather than jni.

Any help is appreciated.

+1  A: 

find / -name "mylib.so" 2>/dev/null

If the filename is a symbolic link, follow the link to the actual lib.

Duck
hi, thnx for the reply, could you please elaborate on wht this command means?
pradeep122
It is the basic form of the find command. Basically start looking for the file named "mylib.so" at the root directory and recursively check all directories in the file system for files of that name. Normally you wouldn't start at root but since you had no idea where the file was starting there would check everything. The 2>/dev/null just redirects error messages (written to stderr) to a system bit bucket i.e. nowhere. This prevents you from having to see a blur of messages saying "you don't have permissions to view this directory" which you would see if you were not running as root.
Duck
thnx for your patient reply duck!
pradeep122
+1  A: 

The answer will differ depending on which library you are looking for.

You will find some in /lib

others in /usr/lib

depending on what you have installed you may also find .so's in /usr/local/lib

and possibly anywhere else in the system (see Duck's answer above for a way to find them all).

For a specific library you have installed from a package, for instance the JNI .so installed by the sun-java6-bin package you use dpkg to query for the package listing and look for where the files are you want.

dpkg -L sun-java6-bin | grep '\.so'

Which will indicate that most of this package is installed under /usr/lib/jvm/java-6-sun-*.

If you aren't sure which package your java was installed with you can search the list of installed packages with:

dpkg -l | grep java

I hope this helps.

Recurse
thnx a lot, it did help.. I found it in /usr/local/libbut I way I found it was using the locate command, i had to use updatedb first though!
pradeep122