DMelt:Programming/9 External libraries

From HandWiki
Jump to: navigation, search
Limitted access. First login to DataMelt if you are a full DataMelt member. Then login to HandWiki as a user.

Table of contents

External libraries

DataMelt can be used for dynamic download of external java libraries, as long as they are inside self-contained jar files. In the case of scripting languages, you can download a jar file and perform calculations in the same script using the class jhplot.Web jhplot.Web.

Here is an example how to use Michael Thomas Flanagan's Java Scientific Library [1] which cannot be shipped with DataMelt due to license restrictions:

# 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 download

# Class to demonstrate the fourth order Runge-Kutta method in class RungeKutta.
# Michael Thomas Flanagan

from jhplot import Web
print "Loading ",url
print Web.load(url)

from flanagan.math import ArrayMaths

# create an array
print "Index of minimum  is ", ar.minimumIndex()

This script download the self-contained flanagan.jar and individually uses it in the same script.

Note if you execute this script second time, this jar file will not be downloaded since it cached inside the disrectory "lib/usr" of the DatMelt installation.

If you are using DataMelt gui and you need to download some restricted libraries, call this command inside the BeanShell (button of the DatMelt GUI):


it will download some external libraries. Then please restart DataMelt GUI.