Skip to content

Commit 63c127c

Browse files
committed
Fix JNI library loading for new JRE versions.
The error message now has the library path printed after it. To support both old and new error message formats, we accept any text after the message "no tox4j-c in java.library.path".
1 parent d41705b commit 63c127c

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

build.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// General settings.
22
organization := "org.toktok"
33
name := "tox4j-c"
4-
version := "0.2.1"
4+
version := "0.2.2"
55
scalaVersion := "2.11.12"
66

77
bintrayVcsUrl := Some("https://github.com/TokTok/jvm-toxcore-c")

src/main/java/im/tox/tox4j/impl/jni/ToxLoadJniLibrary.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ object ToxLoadJniLibrary {
1515

1616
private val AlreadyLoaded = "Native Library (.+) already loaded in another classloader".r
1717
private val NotFoundDalvik = "Couldn't load .+ from loader .+ findLibrary returned null".r
18-
private val NotFoundJvm = "no .+ in java.library.path".r
18+
private val NotFoundJvm = "no .+ in java.library.path.*".r
1919

2020
private def withTempFile(name: String)(block: File => Boolean): Boolean = {
2121
val (prefix, suffix) = name.splitAt(name.lastIndexOf("."))
@@ -113,7 +113,8 @@ object ToxLoadJniLibrary {
113113
case NotFoundDalvik() =>
114114
logger.error(s"Could not load native library '$name'; giving up.")
115115
false
116-
case _ =>
116+
case msg =>
117+
logger.error(s"Unhandled UnsatisfiedLinkError: '$msg'.")
117118
false
118119
}) {
119120
logger.debug(s"Loading '$name' successful")

0 commit comments

Comments
 (0)