简体   繁体   中英

java.lang.UnsatisfiedLinkError error on linux

I have a third party java application called MITIE that I am currently testing to potentially integrate it into a java project. I have compiled the code and can run it using the following script (run.sh):

export LD_LIBRARY_PATH=/opt/MITIE/mitielib
export CLASSPATH=/opt/MITIE/mitielib/javamitie.jar:.

javac NerExample.java
java NerExample

Everything runs fine. What I want to do is be able put the export commands in my ~/.bashrc so I can run this library within a java project or just type java NerExample on the command line and not have to worry about setting the LD_LIBRARY_PATH or CLASSPATH.

I added the two export statements to my ~/.bashrc profile and then removed them from the script and I get the error:

Native code library failed to load. 
java.lang.UnsatisfiedLinkError: no javamitie in java.library.path

If I put the export statements back into the script it works. My question is, is it possible to set these globally on my system?

Your classpath can be extended in /etc/profile export classpath=$CLASSPATH:/add/to/classpath. Sorry I am typing on my phone so you need to correct that. aps.

Your LD_LIBRARY_PATH is not necessary if you add a line to /etc/ld.so.conf then sudo ldconfig.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM