Chapter 5. Modules and Packages

Modules and Packages

In Jython, one must manage Jython modules and packages, as well as Java packages and classes. Jython imports and uses all such items, but imports from where? Java uses the classpath to locate Java packages and classes while Python has the sys.path to locate and load its modules. Jython’s appeal is that it uses both. This becomes an interesting quagmire when implementing both such mechanisms, but what appears to be hairy behind the scenes, merely creates choices for the Jython user.

The study of these choices begins with the import statement, followed by a quick comparison of Java and Python conventions. The middle ...

Get Jython for Java Programmers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.