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.
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.
getValue() methods are now replaced by
getValueAsObject() method is now replaced by
getErrorInfo() methods have been replaced by exceptions thrown by the
evaluate() methods. The
parse(String) method throws
ParseExceptions and the
evaluate() method throws
Jep() initializes the
StandardComponents set which include all the standard functions and constants, no call to
addStandardConstants() is necessary.
EvaluationException instead of
addComplex() method has been removed - the i constant and the complex related methods are now
StandardFunctionTable when Jep is constructed
with the default options (using
SymbolTable class has been renamed to VariableTable.
addStandardFunctions() method has been removed. Standard functions are included by default.
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.
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.
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
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
todir, then run
replace to perform a set of search/replace operations on the files in
clean target will remove all files from
Use with care.