Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Download the latest distribution of Janino from the download page.

Anchor
installation
installation

...

Unzip the distribution file you have downloaded:

Code Block

$ jar xvf janino-*.zip

Change to the Janino directory

Code Block

$ cd janino-*

You will find the Janino JAR files, the source code ZIP files, the text of the BSD license, and a README file.

...

Use one of the features, e.g. the "expression evaluator", in your program:

Code Block
     import org.codehaus.janino.*;

    ExpressionEvaluator ee = new ExpressionEvaluator();
    ee.cook("3 + 4");
    System.out.println(ee.evaluate(null));

Compile, run, ... be happy!

Examples

The ShippingCost class demonstrates how easy it is to use Janino as an expression evaluator.

The ExpressionDemo class implements a command line-based test environment for the expression evaluator.

The ScriptDemo class implements a command line-based test environment for the script evaluator.

The ClassBodyDemo class implements a command line-based test environment for the class body evaluator.

The DeclarationCounter class implements a command-line utility that counts class, interface, field and local variable declarations in a set of JavaTM source files.