How to use a dynamic library?
See original GitHub issueHi,
thanks a lot for this cool project!!
I would like to explore it for cheminformatics analysis and would therefore like to use the Java bindings of the RDKit toolkit.
The bindings consist of a jar
artifact and a dynamic library (.so
for Linux).
In the Idea IDE, I configure the program for the location of the dynamic library with this line in the build.gradle.kts
:
jvmArgs = listOf("-Djava.library.path=$rdkitKnime")
with rdkitKnime
being the path to the dynamic library.
Then, in the program, I call System.loadLibrary("GraphMolWrap")
once, to actually load the library.
Is there a corresponding possibility to modify the java.library.path
in kotlin-jupyter?
@file:Repository("file:///home/pahl/dev/github/knime-rdkit/org.rdkit.knime.bin.linux.x86_64/os/linux/x86_64")
followed by
System.loadLibrary("GraphMolWrap")
in a new cell does not work, it gives a no GraphMolWrap in java.library.path
error.
Many thanks for your help.
Kind regards,
Axel
Issue Analytics
- State:
- Created 2 years ago
- Comments:10
Thanks, reproduced. It is a weird issue related to classloaders, but I’ve built up a JAR for you (unpack it from ZIP first). It works without any additional settings, just specify path to it in the
@file:DependsOn()
and you’re all set. rdkit-jupyter-1.0.0.jar.zipI have also published this JAR in Maven Central, so you may avoid downloading it manually:
@file:DependsOn("org.jetbrains.kotlinx:rdkit-jupyter:1.0.0")
You may also build this JAR from this repo using
./gradlew shadowJar
Wow, very cool.
I did not understand half of your explanation (only getting started with Kotlin and have no real prior experience with the JVM, but have used a number of other programming languages).
Thanks a TON for your help!!!
Kind regards,
Axel