Migrating to Jep 3

Jep 3 brings a number of significant changes with it. So if you are currently running version 2.x, you will need to make some changes to your code. We recommend using Jep 3 as described in this documentation, but we have also provided compatibility classes that ease the transition.

This page gives you tips on performing the migration with or without the compatibility classes.

Changes that affect migration

The package structure has changed significantly. All classes that were previously in the org.nfunk.jep package are now located under com.singularsys.jep. The organization of the classes has changed significantly as well.

Migrating without compatibility classes

You will need to make changes to your code according to the changes mentioned above. Take special note of the new defaults since they will not necessarily be apparent when compiling your code.

Migrating with compatibility classes

The compatibility classes include the old org.nfunk.jep.JEP class as well as the old examples and tests. The org.nfunk.jep.JEP implementation uses a Jep 3 instance from com.singularsys.jep.Jep internally to perform the parsing and evaluation. Note that the Jep class has been deprecated and may not be included in future versions of the Jep package.

If you only use the Jep class in your code, your program might compile without making any changes. But if you rely on other classes that have been moved to the new package location, you will need to at least change import statements.

Conversion script

The Apache Ant script ./bin/import.xml contains a set of Ant tasks to perform most changes necessary to convert Jep 2.x code to run under Jep 3.x.

Open the file in a text editor and set the fromdir and todir directories to the directory where your code resides and the directory to which you would like the modified files to be output. The conversion is a two step process. First run the import task to copy the files from fromdir to todir, then run replace to perform a set of search/replace operations on the files in todir.

The clean target will remove all files from todir. Use with care.