An old and difficult problem about "UnsatisfiedLinkError"

Hi dear all,
I have been struck with the problem about "UnsatisfiedLinkError". I have a c++ class HelloWorld with a method hello(), and I want to call it from within a java class. In fact, I have succeeded in calling it on the windows platform. But when I transfer it to linux, the error "UnsatisfiedLinkError" comes out. I have tried to take the measures as Forum has suggested, but it failed.
The source code is very simple to demonstrate JNI.
"HelloWorld.h"
#ifndef INCLUDEDHELLOWORLD_H
#define INCLUDEDHELLOWORLD_H
class HelloWorld
public:
void hello();
#endif
"HelloWorld.cpp"
#include <iostream>
#include "HelloWorld.h"
using namespace std;
void HelloWorld::hello()
cout << "Hello, World!" << endl;
"JHelloWorld.java"
public class JHelloWorld
public native void hello();
static
System.loadLibrary("hellolib");
public static void main(String[] argv)
JHelloWorld hw = new JHelloWorld();
hw.hello();
"JHelloWorld.cpp"
#include <iostream>
#include <jni.h>
#include "HelloWorld.h"
#include "JHelloWorld.h"
JNIEXPORT void JNICALL Java_JHelloWorld_hello (JNIEnv * env, jobject obj)
HelloWorld hw;
hw.hello();
All the files are in the same directory and all the processes are under the dirctory:
1. javac JHelloWorld.java
2. javah -classpath . JHelloWorld
3. g++ -c -I/usr/java/jdk1.3/include -I/usr/java/jdk1.3/include/linux JHelloWorld.cpp HelloWorld.cpp
4. ld -shared -o hellolib.so *.o
5. java -cp . -Djava.library.path=. JHelloWorld
Exception in thread "main" java.lang.UnsatisfiedLinkError: no hellolib in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1349)
at java.lang.Runtime.loadLibrary0(Runtime.java:749)
at java.lang.System.loadLibrary(System.java:820)
at JHelloWorld.<clinit>(JHelloWorld.java:7)
Tried another measure:
i) export LD_LIBRARY_PATH=.:$LD_LIBRARY_PATH
ii)java -cp . JHelloWorld
The same error came out as above.
I really don't know what is wrong with it.
Would you like to help me as soon as possible?
Thanks.
Regards,
Johnson

Hi Fabio,
Thanks a lot for your help.
It is very kind of you.
Regards,
Johnson

Similar Messages

  • A Stranger and infrequent problem about Oracle TNSListener

    Today I first set up Oracle 9i( 9.2.0.2 version ) on my OS( Windows XP ),when setting up tnslsnr.exe my OS show a error diaglouge:TNSLSNR.EXE faced a problem,need to be closed.After setting up Oracle,when I create a listener for my global database,and log in the database,the problem I met happened again.So I know,when the TNSLSNR.EXE is called,the problem will happen,how should I fix the problem?And do you come across this condition?

    Below is my Listener.ora's content:
    # LISTENER.ORA Network Configuration File: D:\oracle\ora92\network\admin\listener.ora
    # Generated by Oracle configuration tools.
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = infoserv-7476b1)(PORT = 1521))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = D:\oracle\ora92)
    (PROGRAM = extproc)
    (SID_DESC =
    (GLOBAL_DBNAME = JACTEST.infoservice.com.cn)
    (ORACLE_HOME = D:\oracle\ora92)
    (SID_NAME = JACTEST)
    I want to supplement some infomation:Not only when I log in the database,but when I call command : lsnrctl status,the problem also happen.So I think it's not development file's problem.

  • My Mac is three years old and has crashed about 10 times. I have had to erase and re install Snow Leopard every time,yet it keeps happening.

    I have communicated with apple care every time and they keep telling me there is no problem,so why does it keep crashing. I took it in for repair under warrenty and they told me there was nothing wrong with it yet it crashed again two weeks later and has crashed another 5 times since then,I have to erase and re install each time. It has now crashed again , i have re installed snow leopard and all i get is the spinning wheel and nothing loads..Im over it. I have several mac products including two other imacs that are running fine..

    Run Apple Hardware Test on your computer, the next time your machine crashes try running disk utility on the hard drive.  You shouldn't need to reinstall the OS each time your system crashes, if that the case then you could have a bad hard drive. 

  • Lost IPTC meta data on TIFF import -- old and unsolved problem?

    Hi,
    this is my first post, after using Aperture on a casual basis for 7 months.
    Browsing the forum I found the same problem in older threads but the solutions do not help in my case: When I export pictures with IPTC I set in Graphic Converter, metadata will be imported from the RAW (NEC from a Nikon D80) and from JPEG files, but not from the TIFF, whatever encoding or byte order I choose.
    Any help in that matter?
    Thanks,
    Maria
    G5, G4 iBook   Mac OS X (10.4.10)  

    You didn't say which version of Aperture you are using. Up until the recent updates I found Aperture missed, or cut off, a log of IPTC data when I imported RAW files. This seems to be solved with the current version, but ratings still don't get imported.
    I used Annoture (http://www.tow.com/annoture/) to copy over the data. I would import the images into Aperture, then also into iView Media Pro. I'd select all the images in Aperture and then run Annoture. Annoture would take all the IPTC data from the iView catalogue and copy them to the selected images in Aperture (also works on selected projects I think).
    It's a long winded solution, but did the job.
    MacPro, 30" Cinema Display   Mac OS X (10.4.8)   MacBook

  • K7N2 Delta Series and hdd problem

    10 HDD's in machine, about 3 TB (1 TB Lacie external hdd included)
    Secondary slave had 160 GB Samsung SP model and it showed it as 130 gb
    (and rest is "blank" and can not been formatted or anything)
    I thought it went broken (1 year old and no problems before)
    I tried it in another computer and it showed all 160 GB.... Strange.. 
    Now i got new same kind 160 GB Samsung and it is just 131 069,3 MB
    It just maximum i can now make a partition.. Where is rest of my 160 GB disk ?
    What is wrong now.. newest bios, Windows 2000 SP 4 with all updates,
    did mobo just broke ? 

    its not mobo problem. its OS related. all delta series works fine no problem with any hdd's
    this links must be usefull for  you:
    http://support.microsoft.com/?id=305098

  • Help with opinion on new battery... only 14 months old and its bad

    Got an early 08 MacBook Pro 15.4" Coconut Battery says 167 cycles with 48% capacity remaining... Computer is 14 months old and it gets about 1.5-2 hours of battery to a charge..
    Should i go for aftermarket or OEM battery replacement? Im going to Kuwait for deployment and need something that will last.. Apples OEM are expensive but i know you get what you pay for sometime but aftermarket batteries can be just as good..
    Where is a good site to get one?? THANKS!

    aftermarket batteries can be just as good..
    You want to be certain that such batteries are not 'old stock' (as I had happen to me once).
    Kuwait
    High temperature can be a real life shortener for batteries.

  • Hi, my Macbook says its connected to the internet, but it's not working.  It's about 2 years old and has been fine up until now.  Its the same internet provider and I have a work PC laptop that is connecting fine.  Any help greatly appreciated.  Liz

    Hi,
    My MacBook Pro won't connect to the internet, although it says it is connected.  The laptop is about 2 years old and up until now has worked fine.  My work PC laptop is connecting to the internet fine so I know it can't be the connection.   I've checked for Adware/Malware (just in case) via safemac and that all seems fine.
    I'm running OSX 10.8.5.
    Any advice would be greatly appreciated.
    Many thanks
    Liz

    Believe it or not, that article helped me find a temporary solution. After reading it I realized that the problem did have to do with my DNS settings. I had taken the DNS settings that my ISP gives me when I dial up and plugged them into the configuration for my AirPort card. This apparently caused a problem because, although my wireless network is always on, it's not always connected to the internet. So those DNS settings were invalid most of the time.
    I found that as long as I leave the area for DNS servers blank, the computer logs in normally. This further confirms my suspicion that something was trying to access the internet at login. I guess as long as I don't specify any DNS servers, the computer realizes it doesn't have an internet connection through my AirPort card.
    So I just created two network locations: one for when my network is connected to the internet and one for when it isn't. In the first, I kept my original DNS settings because they work as long as I have an internet connection. In the second I did not specify any DNS servers. This seems to work fine, but I'd still like to know what is trying to access the internet at login. I've disabled the automatic update feature in all my programs that have it, but that doesn't seem to help the slowdown at login. Does anyone know how I could figure out what program is trying to access the internet?

  • IWork apps no longer sync with iCloud. I am on iOS 5.1,1, and this problem is several days old, before it was working fine. Anyone has an idea?

    iWork apps no longer sync with iCloud. I am on iOS 5.1,1, and this problem is several days old, before it was working fine. Anyone has an idea?

    Sadly this is not a new problem and I would not expect a forthcoming solution.  I bought an iPad 3G and the iWork suite at the end of August and iCloud syncing worked fine.  About the time Apple rolled out iOS 6 the syncing stopped working for me (without me upgrading or changing anything).  It has never really worked since.   Run iOS 5.1.1 on both the iPhone 4 and iPad 3G.  The "geniuses" claim that Apples iOS 5 requirement is not correct and that I MUST upgrade both to ios 6 (although I know for fact that lots of folks STILL have the iCloud probs even with its 6.  The last genius basically shrugged and non-verbally acknowledged the iCloud/iWork failing and suggested "just use Dropbox.". So why the **** did we pay for iWork!?!?!
    Basically the  iwork/iCloud Connnection is broken and I have yet to get a viable solution to repair the issue.  Sorry for the bad news.  For reference I have uninstalled/installed each iteration of iWork upgrades on each device without success.  I have reset all settings multiple times, turned iCloud off/on repeatedly etc etc without success.  I even wiped the iPad and restored from iCloud w/o intention (another Apple IPad "glitch" when I tried the "reset all settings" and the iPad decided to "erase all" instead.  The genius said "it happens.")
    Oddly, the Pages app is the only one that has marginally worked at times since the first probs.  However it is basically broken and non-functioning.  Certainly DO NOT trust vital documents to iCloud/iWork.  I lost a number of work critical docs in this whole annoying, messy process of trying to get what Apple promised as easy....

  • "SQlite Version Error The application has been updated, but your version of SQlite is too old and the application cannot run." What is this all about?? Shall I give up on Firefox?

    When I tried to use Firefox this morning I got this message with exclamation marks.
    "SQlite Version Error The application has been updated, but your version of SQlite is too old and the application cannot run."
    What is this all about?? Shall I give up on Firefox?

    Sorry to hear that. I understand your frustration and I hope they send back a better working N78-3.
    Myself, I count myself lucky. Everything works perfectly for me right now...email, bluetooth, maps, gps, 3rd party apps, battery life, 3G, wifi, etc. etc.
    The only issue I've been having is the dreaded reboots but I believe that may have to do with 3rd party apps. I recently uninstalled Google Search app from my N78 and since then it hasn't rebooted or shown any issues. This seems odd at first but makes sense if you think about the fact that the Google Search app loads itself into memory and runs in the background at all times.
    I did this this past Tuesday night and so far no reboots, crashes or any problems. I'm sure I just jinxed myself but I've been using it heavily over the last few days with no issues. Prior to this, it would usually reboot every 2 days. If it doesn't reboot for another few days I'll be happy.
    I would normally not stand for this but I just love the phone and if I got something else it'd probably be the iPhone 3G which has perhaps more software bugs and issues than the N78-3!!
    Best of luck. Here's hoping they release an update soon.

  • My/keyboard/green/light/goes/out/and/the/space/bar/and/caps/lock/keys/donot/work /.I/have/100%/battery/life.I/show/connected/to/bluetooth.Anyone/know/the/approxi mate/life/of/a/keyboard?Mine/is/about/4/years/old.Using/an/iMac/about/4/years/ol d,too.

    My/keyboard/green/light/goes/on/and/off./The/space/bar/and/caps/lock/keys/do/not /work/.I/have/100%/battery/life.I/show/connected/to/bluetooth.Anyone/know/the/ap proximate/life/of/a/keyboard?Mine/is/about/4/years/old.Using/an/iMac/about/4/yea rs/old,too.

    Could be an early retirement problem.  There is no fixed lifespan for anything, as you know.   Find a friend with a keyboard and test that in your machine.  That will show if it is your keyboard or your computer.   We can progress from there.

  • It's so annoying!! I have created a new Apple ID but after I click verify it just goes back to the previous page!!! It''s really frustrating I have tried for more than 4H, and the problem is not about the apple ID. I can download apps with the apple ID, w

    It's so annoying!! I have created a new Apple ID but after I click verify it just goes back to the previous page!!! It''s really frustrating I have tried for more than 4H, and the problem is not about the apple ID. I can download apps with the apple ID, which means IMessage is the problem! I restarted my iPad, I logged in and out of the apple ID in the store, AND YET IT STILL WON'T WORK, PLEASE HELP!

    Hi Vmanfromusa!
    It sounds like you are having an issue with activating your iMessage app on your iPad. An article outlining some troubleshooting steps for this issue can be found here:
    iOS: Troubleshooting FaceTime and iMessage activation
    http://support.apple.com/kb/ts4268
    Thanks for using the Apple Support Communities. Have a good one!
    -Braden

  • I have a new Macbook pro, about 2 months old, and at times running video, the fans starts and does not stop. how do you get it to stop.

    I have a new Macbookbook, about 2 months old, and at times running video, the fans starts and does not stop. how do you get it to stop. Also i am thinking once the video is done  the fan should be slowing down and getting quiet on its own.

    Your fan(s) will run at high speed (i.e., loudly) while video is playing, and you can't get around that.
    If your fans are not slowing down within 2-4 minutes after CPU- and/or GPU-intensive usage ends, and the application that was showing the video is still running, Quit that application. (In fact, if you're accustomed to Windows, you may not realize that simply closing a Mac application's window does not quit the application. You still need to use the Quit command in the application-name menu. There will always be a bright dot beside or below the application icon in your Dock for each application that is open.) Quit the ones you aren't using, and see whether that allows the fans to slow down without restarting the machine. If that doesn't do the trick, reset the SMC:
    http://support.apple.com/kb/HT3964?viewlocale=en_US&locale=en_US

  • I have an older version of Adobe Digital Editions (around 3 years old) and was very happy with it.  Then I had problems with my Kobo Reader and asked a friend who works in IT to assist. She could not fix the Kobo but she messed up my Addobe. She downloade

    I have an older version of Adobe Digital Editions (around 3 years old) and was very happy with it.
    Then I had problems with my Kobo Reader and asked a friend who works in IT to assist. She could not fix the Kobo but she messed up my Addobe. She downloaded version three and I have an account and a password - was not able to transfer my books from my reader to version three (and I don't like the lay-out - I would prefer to stay with the old version as I also loose all my download date info..)
    But all the books I have bought over the last three years are in the old Adobe Digital and I cannot access them any more. When I use it I get the message "that the document is licensed to a different account. I can't even open the books on my computer.
    When I go to my Kobo library, I cannot also not open my books and get the message "this doc is protected by adobe digital rights management and is not currently authorized for use with your adobe. please sign in with your authorized adobe id and try again"
    I believe the problem is that I do not seem to have a digital id for my old adobe or that the Kobo is not in sync with it anymore.
    can you please help me - going on vacation in three days and cannot go without books.

    Please authorize ADE 3 with same credentials that you used with older version of ADE

  • HT204053 i want to change my icloud id on my iPhone, but it won't let me now that i have upgraded.  I no longer have the password and the problem is It is using an old id which the email isn't valid and the security question does not think my birthday is

    I want to change my icloud id on my iPhone, but it won't let me now that i have upgraded.  I no longer have the password and the problem is It is using an old id which the email isn't valid and the security question does not think my birthday is valid.  I cannnot delete the account because "find my iphone" wants the password linked to this old account.  But when i go into the find my iphone app it is using my corect Apple ID.  How do i fix this?

    If you still have access to your old email address, go to https//appleid.apple.com, click Manage my Apple ID and sign in with your iCloud ID.  Tap edit next to the primary email account, tap Edit, change it back to your old email account and verify it.  Then edit the name of the account to change it back to your old email address.  You can now use your current password to turn off Find My iPhone on your device. Then go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud).  Next, go back to https//appleid.apple.com and change your primary email address and iCloud ID name back to the way it was.  You can now go to Settings>iCloud and sign in with your correct iCloud ID and password.
    If you don't have access to your old email address, you will have to contact Apple to have them reset the password so you can disable Find My iPhone and sign into your iCloud account.  You can either go to https://expresslane.apple.com, select "More Products and Services", then "Apple ID", then  on the next page select "Other Apple ID Topics", then "Lost or forgotten Apple ID password" and click "Continue"; or you can contact Apple Support (http://www.apple.com/support/icloud/contact/).

  • I run a Windows 8.1 -  Photoshop CS5 under Parallels on an iMac one year old and both having the latest OS. I use a NIK plugin "VIVEZA" which run fine for years without a problem. Latelt and without a reason, the NIK plugin has gone corrupt, (can not use

    @I run a Windows 8.1 -  Photoshop CS5 under Parallels on an iMac one year old and both having the latest OS. I use a NIK plugin "VIVEZA" which run fine for years without a problem. Latelt and without a reason, the NIK plugin has gone corrupt, (can not use it more the 2 corrections after a get a black background message that there is not enough memory) and the system stops running and a must restart is required. How do I fix this terrible problem?
    If it requires a Photoshop CS5 re-install, (I belief that it may fix the problem) and re-install the two third party plugins (NIK Viveza) and (Onone Perfect Resize) how and where do I get to the proper Adobe upload page to do that.
    I have tried to fix this problem by changing the memory allocations, I have spend many hours on it and are very disgusted with it but it needs to be fixed. The current memory settings are;
    Ram available = 1588 MB
    Range = 873 -1143 MB
    Recommended Photoshop usage range =  857  however I have tried every setting to max and in between. Nothing works. Current setting = 1588 (max)
    The Photoshop I use is registered, I have product # and order # .

    Contact NIK for updated/upgraded versions of their plug-ins.  They have been having a lot of issues with their plug-ins.

Maybe you are looking for