question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use a dynamic library?

See original GitHub issue

Hi,
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:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
ileasilecommented, May 1, 2021

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.zip

I 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

1reaction
apahlcommented, May 1, 2021

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating and Using Dynamic Libraries ( C ) | by Afa Madza
To create a dynamic library in Linux, simply type the following command: gcc *.c -c -fPIC and hit return. This command essentially generates...
Read more >
How dynamic linking for modular libraries works on Linux
Dynamic libraries are linked during the execution of the final executable. Only the name of the dynamic library is placed in the final ......
Read more >
Using Dynamic Libraries - Apple Developer
All you need to do to use a dynamic library as a dependent library is include the library's headers in your source code...
Read more >
Using Dynamic Libraries
Using Dynamic Libraries · Static. Static library names are suffixed by .a . A static library is a collection of binary object files...
Read more >
What is a Dynamic Library? - Definition from Techopedia
A dynamic library is a programming concept in which shared libraries with special functionalities are launched only during program execution, which minimizes ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found