java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V

By | 9月 19, 2023
-Djava.io.tmpdir=/tmp/xxx

原因是:临时文件 ‘/tmp/xxx’ 不存在。

参考:java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V

后记

我在这个问题上耗了很久,IDE和Test用的不同server node,虽然它们的home都一样,但是它们的/tmp却是不一样的。导致我一直忽略了IDE node上其实是没有/tmp/xxx目录的,最后加了下面代码,debug才发现这个问题。

final File tmp = new File(System.getProperty("java.io.tmpdir"));
if (!tmp.exists() || !tmp.isDirectory() || !tmp.canRead() || !tmp.canWrite()) {
	throw new SQLException("error with tmpDir");
}