Skip to content, Skip to search

Changes

Jython Scripting

173 bytes added, 12 February
m
Self written Jython modules for ImageJ: Mention the manual way to reload compiled module
This tells us that the folder <code>jars/Lib/</code> inside our ImageJ/Fiji directory is the right place to save modules. As <code>Lib/</code> does not exist by default, we have to create it.
When a module is imported for the first time, Jython will compile it to Java code. If there is a module named <code>myModule.py</code>, Jython will create a file called <code>myModule$py.class</code>. The next time the module is imported, Jython will use the jython interpreter uses the <code>.class </code> file instead of the <code>.py </code> file, even if this <code>. When modifying py</code> file was modified.  To force the module, it necessary interpreter to restart ImageJ/use the last version of the py script there are 2 possibilities : * Close Fiji to use , delete the modified one<code>myModule$py. A work around is class</code> file and restart Fiji* Use the following lines of code (found at [http://stackoverflow.com/questions/10531920/jython-import-or-reload-dynamically stackoverflow]) that will force Jython to recompile all modules:
<source lang='python'>
Emailconfirmed
91
edits