LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.02k stars 128 forks source link

java.lang.UnsatisfiedLinkError: no node in java.library.path - Unit Test #57

Closed sboishtyan closed 6 years ago

sboishtyan commented 6 years ago

Hello everyone, i try to write unit test, that use JSContext and when the static initializer executes, static { System.loadLibrary("node"); System.loadLibrary("liquidcore"); } then i see following stacktrace: java.lang.UnsatisfiedLinkError: no node in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1122) at org.liquidplayer.javascript.JSContext.<clinit>(JSContext.java:52) what is the correct way to tell java where is my libs? I find some solution to modify java.library.path property, but i don't now is this an effective way.

ericwlange commented 6 years ago

Hello @sboishtyan . You can't use native libraries in unit tests. You have to use instrumentation tests instead, as the libraries require access to the emulator (or device).

See: https://developer.android.com/training/testing/unit-testing/instrumented-unit-tests

sboishtyan commented 6 years ago

@ericwlange Hello, thank you, but i knew about this aproach. My case is run on my desktop.

ericwlange commented 6 years ago

@sboishtyan Not sure I understand the issue. Are you trying to run this outside of Android?

sboishtyan commented 6 years ago

@ericwlange Yes, i'm trying to run this on my local machine.

ericwlange commented 6 years ago

I don't think it will work. LiquidCore depends on the Android runtime environment. It is not generic Java.