how to compile in jython 2.5b1??

Diez B. Roggisch deets at nospam.web.de
Wed Feb 4 16:55:48 EST 2009


ruelle schrieb:
>> What do you need jythonc for? That's purely for a somewhat neater
>> integration of *Java* with jython - nothing to do with sympy.
>>
>> Diez
> 
> I need jythonc to compile a simple script in java,
> this script import SymPy library.

You need to find other ways.

The usual approach to this is a factory-pattern with an embedded 
Jython-interpreter. There is the Jython-magazine that a couple of years 
ago brought a few examples of these techniques. They roughly work as this:


  - create a jython-file contains a jython-class 
subclassing/implementing some Java class or interface.

  - write a java-class that instantiates a jython interpreter

  - make that intepreter execute a small script (one-liner) to create 
one  instance of that jython-class, and assigns it to a global variable.

  - fetch that variable's value from the interpreter-instance, and pass 
it to some java-code that works with it.

This is working for nearly *all* use-cases, the exception only being 
rare casese where some Java-framework itself uses something like 
classForName to instantiate a class (e.g. struts for action-classes)

But even then, you could simply create a java delegation class with the 
same recipe.

There really is no need for the Jythonc, which is the reason it is 
discontinued I presume.

Diez



More information about the Python-list mailing list