Download external jar library and dynamically load it
Source code name: "loadjar_dynamic.py"
Programming language: Python
Topic: Tools/Misc
DMelt Version 2.2. Last modified: 10/20/2018. License: Free
http://datamelt.org/code/cache/loadjar_dynamic_1655.py
To run this script using the DMelt IDE, copy the above URL link to the menu [File]→[Read script from URL] of the DMelt IDE.


# This example shows how to download a jar library,
# dynamically load it and execute a class from the downloaded library.
# The downloaded jar will be located in lib/user directory.
# Second execution will skip the download

from jhplot import Web

url="http://central.maven.org/maven2/it/unimi/dsi/fastutil/8.2.2/fastutil-8.2.2.jar"
print "Loading ",url
print Web.load(url)

from it.unimi.dsi.fastutil.longs import Long2IntAVLTreeMap
m =Long2IntAVLTreeMap()
# Now we can easily modify and access its content
m.put(1, 5)
m.put(2, 6)
m.put(3, 7)
m.put(1000000000L, 10)
print m