Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Accessing methods in linux .so file

881629Aug 10 2011 — edited Aug 10 2011
Hi,

I have been given a .so file from a third party that is developed in C++. The file is named convertor.so


If i run
objdump -tT convertor.so 
I get the following where the method I need to invoke in Java is named ConvertSingle, it is listed in the dynamic symbol table rather than the symbol table
convertor.so.so:     file format elf32-i386
SYMBOL TABLE:
no symbols
DYNAMIC SYMBOL TABLE:
0000af40 g    DF .text	0000034a  Base        ConvertSingle 
I have created a Java class as follows;
public class ConvertClass{

        static{
          System.loadLibrary("convertor");
        }
        private native int  ConvertSingle(byte[] byteArray);

        public static void main(String args[]){

            ConvertClass myClass = new ConvertClass():
          }
         } 
But if I try to invoke my compiled class using java ConvertClass, I am constantly getting the error below;

exception in thread "main" java.lang.UnsatisfiedLinkError: no convertor in java.library.path
	at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1738)
	at java.lang.Runtime.loadLibrary0(Runtime.java:823)
	at java.lang.System.loadLibrary(System.java:1028)
	at ConvertClass.<clinit>(ConvertClass.java:5)
Could not find the main class: ConvertClass.  Program will exit.
 
I have set the ld_libray_path
LD_LIBRARY_PATH=.
export LIBRARY_PATH
ldconfig.
 
Could anyone help as to what I might be doing wrong?

Any help would be very much appreciated.

many thanks.
DM

Edited by: user5780461 on Aug 10, 2011 10:54 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 7 2011
Added on Aug 10 2011
1 comment
573 views