Using Java in a Jython Project

A mixed Jython-Java project is typically created to use the project's Java classes in the project's Jython modules. Here are the steps to setup a mixed Jython-Java project so that the Java classes are found when a Jython module is run.

Note: At this time, JyDT does not provide the ideal solution, which would be the ability to add the Java build path to the Jython system path.

  1. Assume that you have set up a mixed Jython-Java project. In the example project below, the Java project uses "src" as the Java source folder, "bin" as the output folder, and "jython" as the Jython source folder.

  2. Further assume that the files "" and "" contain the following source code. The Jython module defines a class that inherits from the Java class and overrides a method. (Do not mind the error marker on the import statement. That is a limitation of JyDT at this time.)

  3. Open the "Jython Class Path" in the properties of the project. Add the "bin" folder by pressing "Add Folder" button. Here the note from the beginning of the page comes in: the path to the "bin" folder is not relative to the project, which is not desired, but it works in the current version of JyDT.

  4. Select the module "" and choose "Run As > Jython" from the "Run" menu or from the toolbar.

  5. The module is executed. The output on the console is as expected.

  6. Let's have a look at the run configuration. Eclipse has recognized the folder entered in the Jython class path as a folder in the project ("bin - \Mixed Java-Jython Project\").

  7. Done.