I have an application using Jython 2.1. In the app I was using jythonc to convert the python scripts to java classes and then include these classes in my webapp like any other. So I was able to assign package name to python scripts and access these classes like any other java class.
Now I plan to migrate to Jython 2.5. Jython 2.5 has removed support for jythonc. So I tried to use
jython -m compileall /path/to/my/python/scripts.
When I do that I get all the compiled bytecode files in the same folder. Each of the files have names like myclass$py.class (where my python file is myclass.py).
My questions -
- First of all can I access these classes in another normal java class?
- If so, what is the class name I should use ? When I use it like new myclass() my code does not compile.
- Is there a way, I can assign / force a package name or class name for the generated bytecode with compileall?
Note -
- I need to upgrade to jython 2.5 because I need newer versions of python that it supports.
- I would like to stick with pre-compiling the python code into bytecode, as I want to do optimizations on the bytecode. So the recommended object factory method is only a last resort. I am assuming the object factory approach will not allow me to process the generated bytecode.
Any help is appreciated.