ClassFile

The ClassFile collection of packages and utilities provides a means of importing Java classes and packages directly into Python, without the need for a Java virtual machine, so that the classes may be instantiated, accessed, run and manipulated just like Python classes, and that the resulting objects and methods can be accessed and manipulated just like Python objects and methods.

Quick Example

cd tests/

javac Value.java

../runclass.py Value

v.getValue() correct: 123
v.getValue() correct: 456
v.isPositive() correct: 1
v.isPositive() correct: 0
v.compare(-790) correct: -1
v.compare(-788) correct: 1
v.compare(-789) correct: 0
v.getValue() == v2.getValue() correct: 0
v2.add(-123) correct: 0
v2.getValue() correct: 255

java Value

v.getValue() correct: 123
v.getValue() correct: 456
v.isPositive() correct: true
v.isPositive() correct: false
v.compare(-790) correct: -1
v.compare(-788) correct: 1
v.compare(-789) correct: 0
v.getValue() == v2.getValue() correct: false
v2.add(-123) correct: 0
v2.getValue() correct: 255

Motivation

Pick one of the following: