简体   繁体   English

适用于Mac上SQLite的java.lang.UnsatisfiedLinkError

[英]java.lang.UnsatisfiedLinkError for SQLite on Mac

I have a Java program compiled into a JAR that runs well on Windows. 我将一个Java程序编译为可以在Windows上良好运行的JAR。 On Mac, it does not run well. 在Mac上,它运行不正常。 I've included the stack trace, I get a 我已经包括了堆栈跟踪,我得到了

"java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(LJava/lang/String;I)V" error “ java.lang.UnsatisfiedLinkError:org.sqlite.core.NativeDB._open(LJava / lang / String; I)V”错误

It seems that it's failing at the second of these two lines in my program: 看来我的程序在这两行的第二行失败了:

Class.forName("org.sqlite.JDBC").newInstance();
connection = DriverManager.getConnection(dbURL + dbLoc); //fails here

I've never seen one of these errors before, some research revealed that it may be a problem with the SQLite version and that I needed to include another JAR Library for SQLite that was compatible for Mac since the snapshot version below was not compatible. 我之前从未见过这些错误之一,一些研究表明,这可能是SQLite版本的问题,并且由于下面的快照版本不兼容,我需要包括另一个与Mac兼容的SQLite JAR库。 I have both of these libraries included in my project's libraries now: 我现在将这两个库都包含在项目的库中:

  • sqlite-jdbc-3.7.2.jar sqlite的-JDBC-3.7.2.jar
  • sqlite-jdbc4-3.8.2-SNAPSHOT.jar sqlite的-jdbc4-3.8.2-SNAPSHOT.jar

Unfortunately I'm still getting the same error message. 不幸的是,我仍然收到相同的错误消息。 Again, the program runs flawlessly on Windows. 同样,该程序可以在Windows上完美运行。 This is a Mac issue only. 这仅是Mac问题。

Anyone have any ideas? 有人有想法么?

Stack Trace:

java -jar "PRG - RYADD.jar" 
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: org.sqlite.core.NativeDB._open(Ljava/lang/String;I)V
at org.sqlite.core.NativeDB._open(Native Method)
at org.sqlite.core.DB.open(DB.java:161)
at org.sqlite.core.CoreConnection.open(CoreConnection.java:145)
at org.sqlite.core.CoreConnection.<init>(CoreConnection.java:66)
at org.sqlite.jdbc3.JDBC3Connection.<init>(JDBC3Connection.java:21)
at org.sqlite.jdbc4.JDBC4Connection.<init>(JDBC4Connection.java:23)
at org.sqlite.SQLiteConnection.<init>(SQLiteConnection.java:44)
at org.sqlite.JDBC.createConnection(JDBC.java:113)
at org.sqlite.JDBC.connect(JDBC.java:87)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:207)
at prgryadd.DBConnect.createConnection(DBConnect.java:43)
at prgryadd.DBConnect.<init>(DBConnect.java:32)
at prgryadd.PRGRYADDView.<clinit>(PRGRYADDView.java:756)
at prgryadd.PRGRYADDApp.startup(PRGRYADDApp.java:19)
at org.jdesktop.application.Application$1.run(Application.java:171)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:682)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:643)
at java.awt.EventQueue$1.run(EventQueue.java:641)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:652)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Got it working. 得到它的工作。 Deleted the other SQLite-JDBC libraries and included only the oldest named "sqlite-jdbc-3.7.15-SNAPSHOT.jar" from the following URL: https://bitbucket.org/xerial/sqlite-jdbc/downloads 从以下URL中删除了其他SQLite-JDBC库,并且仅包含最旧的名为“ sqlite-jdbc-3.7.15-SNAPSHOT.jar”: https : //bitbucket.org/xerial/sqlite-jdbc/downloads

This solved the problem. 这样就解决了问题。 Apparently there are some compatibility issues with the newest SQLite-JDBC library not playing well with Macs. 显然,最新的SQLite-JDBC库在Mac上不能很好地解决一些兼容性问题。 The older versions don't seem to have this problem. 较旧的版本似乎没有此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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