How to Use External Jython Classes in Flux?

Introduction

The version of Jython has been updated from 2.7.0 to 2.7.1.

The new version 2.7.1 offers new interesting modules as numpy and scipy, but only a few tests have been done. However we guarantee the no-regression.

User*.jar library can be placed in a specific folder, and automatically read by Flux.

<INSTALLFLUX>\Third_party\jython-2.7.1\javalib

Goal

Sometimes a user would like to extend the capabilities of the python scripts run by Flux for example to access a database.

This often requires to add third party jars to the classpath of Flux so that those third party classes become available in the Flux Jython session.

Prerequisite

The method described below requires that at least version 2018.1 of Flux is installed.

Step-by-step

Here the step-by-step below:
  1. Download the jar(s) that contains the classes you want to use in Flux Jython
  2. Copy the jar(s) in %INSTALLFLUX%\Third_party\jython-2.7.1\javalib
  3. Start (or restart) Flux

Example

Install the MySQL connector jar in jython-2.7.1\javalib folder:

In MyFlux shell window run the following:

You should get something like below printed in the Output console: