问题
I just installed Jython 2.5.1. I want to convert my Python file into Java class file and it is instructed on the website to use the jythonc command-line tool but I can't find it. Does anyone know where I could find it?
Basically what i was trying to accomplish is to get my Python code running client-side in a browser and the best way seemed to be by creating an applet using Jython. I don't want to create a desktop application and using Silverlight/IronPython is out of the question. Any other ideas are welcomed.
Cheers!
回答1:
Jythonc was removed in Jython 2.2 and is no longer supported. The official way to embed Jython code in Java is to create an instance of the interpreter to run the Jython code directly. There is an article on this here.
Personally I preferred the jythonc method and hope it will be reinstated in a future version of Jython, even though it had a number of issues.
回答2:
You can still compile your python-code to class-files:
import compileall;
compileall.compile_dir('Lib'); # to compile yor Lib-Dir
should work with 2.5 jython
i use it to create class-files to put in jars :-)
来源:https://stackoverflow.com/questions/2763129/jythonc-missing