JAVA呼叫動態連結庫so檔案
最近專案在用到openjdk1.8時,出現以下異常,綜其原因是JDK1.8中libjavajpeg.so估計缺少某些函式。 記錄一下,這裡有一篇關於動態連結庫的文章,比較不錯,轉載推薦一下:http://www.cnblogs.com/duanxz/p/3651347.html
Exception in thread "main" java.lang.UnsatisfiedLinkError: java-8-openjdk-amd64/jre/lib/amd64/libjavajpeg.so: libjpeg.so.8: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at com.sun.imageio.plugins.jpeg.JPEGImageReader$1.run(JPEGImageReader.java:92)
at com.sun.imageio.plugins.jpeg.JPEGImageReader$1.run(JPEGImageReader.java:90)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.<clinit>(JPEGImageReader.java:89)
at com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi.createReaderInstance(JPEGImageReaderSpi.java:85)
at javax.imageio.spi.ImageReaderSpi.createReaderInstance(ImageReaderSpi.java:320)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:529)
at javax.imageio.ImageIO$ImageReaderIterator.next(ImageIO.java:513)