Jython load Java class in code



examples/jython/mymath/Calculator.java
public class Calculator {
    public static Integer add(Integer a, Integer b) {
        if (a == 10) {
            return 10;
        }
        return a+b;
    }

}

examples/jython/mymath/calc.py
# use only with Jython

import Calculator
print(Calculator.add(4, 8))
print(Calculator.add(10, 8))

cd examples/jython/mymath/
java -jar ~/jython2.7.0/jython.jar calc.py