I am running the Jython shell. I was trying to mess around with a few Java classes in the shell, as I am a bit new to using the Jython implementation. However, when I try to create an object, for example, I get the following Traceback.
>>> s = java.lang.annotation
>>> s.Annotation()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: No visible constructors for class (java.lang.annotation.Annotation)
I read this question and tried editing the python.security.respectJavaAccessibility line in my Jython registry to equal false, but that was to no avail.
What could be causing this to happen?
Annotationis not a class, its aninterface[Documentation] . You cannot instantiate an interface , you will have to create a class that implements the Annotation class and instantiate that class.