如何在运行时查找、读取、写入 Jython 注册表

How to find, read, write Jython registry during runtime

我在 ImageJ 环境中使用 Jython 作为宏语言。我想访问私有和受保护的功能。为此,有一个 Jython 注册表项。我找不到注册表文件。 Jython 在 ImageJ 的宏编程环境中运行。我想知道,是否有任何方法可以在 Jython 代码中获取当前注册表文件的路径和条目?

documentation for the Jython Registry 列出了以下注册表文件来源:

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

在您的用户主目录中有一个文件 .jython,其中包含一行:

python.security.respectJavaAccessibility=false

...以下示例脚本将输出 1 而不会引发错误:

from ij import ImagePlus

print (ImagePlus.CLOSED) # a private field

请注意,有关 ImageJ 的特定问题最好在专门的论坛上提出:https://forum.image.sc/tag/imagej