I just started playing with Jython, and sometimes running jython on a .py file generates a .class file, but this doesn't always happen.

At first I thought the trigger was that you had to define a Python class inside the .py file, but evidently a .class file is not always generated even then.

What is the mechanism that triggers the class file?

Thanks.

有帮助吗?

解决方案

With regular Python, .pyc files are generated when you import a module but not when it's the __main__ module.

It is the same with Jython -- .class files are generated when you import a Jython module.

You can use jythonc to manually compile a module.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top