Find the answer to your Linux question:
Results 1 to 4 of 4
hi, I have a c++ program with a class, and many functions. it is basically a phone program.. it can make call, answer call, have conferences, it can transfer calls, ...
  1. #1
    Just Joined!
    Join Date
    Jun 2009
    Posts
    2

    jni in linux

    hi,

    I have a c++ program with a class, and many functions.
    it is basically a phone program.. it can make call, answer call, have conferences, it can transfer calls, it can hold calls etc.,
    now i have written a java native method for a c++ function called start() which is in c++ code.
    this function initializes the phone. once initialized, any activity can be made in that phone(like the functions mentioned above).

    my questions are,

    1. i have just written native method for only one function of the c++ in java.. it is throwing an error

    Exception in thread "main" java.lang.UnsatisfiedLinkError: libsample: /usr/lib/gcj-4.1.1/libsample.so: undefined symbol: pjsua_create
    at java.lang.Runtime._load(libgcj.so.7rh)
    at java.lang.Runtime.loadLibrary(libgcj.so.7rh)
    at java.lang.System.loadLibrary(libgcj.so.7rh)
    at sample.<clinit>(sample.java:4)
    at java.lang.Class.initializeClass(libgcj.so.7rh)

    what does it mean.

    i created a .so file using the g++ and my c++ program.
    i moved that .so file to /usr/lib/gcj-4.1.1 for obvious reasons...
    now why that error????

    is the .so file not reading the header file???
    if so how to link those two??
    any help please...

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    This is because the .so you are linking the libsample.so which has a dependency on a symbol that is not found in that library. You need to determine which library that symbol is implemented in, and link that as well.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Jun 2009
    Posts
    2
    how to link that... please help me.... i'm new to linux

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    I need the make file you used to create your C++ class library, and how you linked that into your Java application (Java source if possible). Don't know if we need your C++ headers or source as yet.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...