imagejjython-2.7

How to find, read, write Jython registry during runtime


I am using Jython as a macro language in ImageJ environment. I want to access private and protected fucntions. For this there is a Jython registry entry. I can't find the registry file. Jython runs within macro programming environment of ImageJ. I was wondering, if there is any way to get the path and entries of the current registry file within Jython code?


Solution

  • The documentation for the Jython Registry lists, among others, the following source for the registry file:

    The user’s personal registry file, which contains similarly formated prop/value pairs. The user’s registry file is at "user.home"+"/.jython"

    With a file .jython in your user home directory, containing the single line:

    python.security.respectJavaAccessibility=false
    

    ... the following example script will output 1 without throwing an error:

    from ij import ImagePlus
    
    print (ImagePlus.CLOSED) # a private field
    

    Note that ImageJ-specific questions are best asked on the dedicated forum: https://forum.image.sc/tag/imagej