I have a strange requirement: end users of a noteb...
# datascience
p
I have a strange requirement: end users of a notebook are required to add a single jar file to the Java class path. This is because the company that provides that jar file, only allows the end-users to use and distribute that jar file and I cannot package it any other way. So my current way of thinking: Step 1 User uploads the jar file to some Jupyter Notebook directory Step 2 Somehow that jar file gets added to the Java classpath. Could perhaps be a function the user could call from a cell, for example: addCustomJar("propriatary-api.jar") • This then could be directly added, using some URLClassLoader magic in the back ground • or install it in the local maven repo (~/.m2) But open to alternatives and any suggestions. Or perhaps something I overlooked that is already available out of the box. Any insights appreciated!
i
Hi, Peter! For local JARs, this will work:
Copy code
@file:DependsOn("/path/to/jar")
This annotation doesn't work for remote URLs though, but it's simple to add (I just didn't think about this use case). When added, Step 1 may be skipped, for now it's required
p
Great, this makes it very easy to add local jar files by end user 👍 Regarding step 1, the end-user also has to click "OK" to a license agreement before the download starts, so I guess cannot avoid that manual step anyway.