I have implemented a Java application that includes Jython to run Python scripts. When I run that application from the IDE (Eclipse or IDEA), then all works fine, the Python scripts are processed correctly.
However, when I package everything into a JAR file (to be released), including the jython.jar
file, then I get the following error as soon as the Java application tries to run the first Python script:
ImportError: No module named os
So it seems that the Lib
folder with all the standard Python modules is not found. I checked the jython.jar
file that is included in the Java application's JAR file, and it does include the Lib
folder correctly. In fact, that is the same jython.jar
file that is also used when I run the application from the IDE, where it works.
I know one can specify the -Dpython.path
paramter, but I don't know what to set here. How can I refer to the the Lib
folder which is within the jython.jar
file which is within the main application's JAR file?