chilkat载入java library path异常 chilkat是一个提供网页下载(保存为.mht)的工具,下载地址:http://www.chilkatsoft.com/downloads.asp 在Java工程下运行的时候没有异常,但是当移植到WEB工程,开启Tomcat时,出现找不到类库的异常,异常代码如下:Native code library failed to load.Java.lang.UnsatisfiedLinkError: no chilkat in java.library.path。 异常分析:在Windows XP下运行chilkat是需要一个chilkat.dll文件,加载的程序代码: static { try { System.loadLibrary("chilkat"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load./n" + e); System.exit(1); } } 默认情况下chilkat.dll放在工程文件子目录下,运行Java工程时,工程的绝对路径是eclipse的工作空间下工程的路径,所以系统根 据相对路径能正确找到chilkat.dll文件;但运行在WEB工程时,加载Tomcat后,系统的绝对路径是Tomcat安装目录下Bin文件的路 径,当需要加载chilkat.dll文件时,系统找不到所需的文件。 解决方法1:指定chilkat.dll存放的绝对路径 static { try { System.loadLibrary("E://ming//workspace//SearchGen//chilkat.dll"); } catch (UnsatisfiedLinkError e) { System.err.println("Native code library failed to load./n" + e); System.exit(1); } } 解决方法2:把chilkat.dll复制到Tomcat安装目录Bin文件下 相关资料一: java.lang.UnsatisfiedLinkError: no chilkat in java.library.path Question: What is this error? Native code library failed to load.java.lang.UnsatisfiedLinkError: no chilkat in java.library.path Answer: Make sure the chilkat.dll is placed in a directory listed in java.library.path. 相关资料二: http://forums.sun.com/thread.jspa?threadID=627890&start=15