|
From: Adam B. <ada...@gb...> - 2001-01-08 23:38:52
|
You are very much on the right track. This is an FAQ: FAQ index: http://jython.sourceforge.net/cgi-bin/faqw.py?req=index 3.3. I'm trying to execute a 'protected' or 'private' Java Instance Method or attribute in a Java package. How can I get access? By default, as in Java, these methods are protected from external access, but there may be reasons, such as test scaffolding scripts, that this feature is not wanted. In the [jython home]/registry file: # Setting this to false will allow Jython to provide access to # non-public fields, methods, and constructors of Java objects. python.security.respectJavaAccessibility = false --- If you want to leave respectJavaAccessibility = true, could you inherit from java.util.Calendar and expose the functionality that way? It may require adding a public method that simply does return self.x() Hope this helps Adam Burke www.gbst.com Garcia, Michael wrote: > > I am trying to call a protected method in the java.util.Calendar class > and am getting: > > >>> l = cal.getTimeInMillis() > Traceback (innermost last): > File "<console>", line 1, in ? > AttributeError: getTimeInMillis > > Why am I getting this AttributeError? I suspect that it has to do with > python.security.respectJavaAccessibility = true. Do I have to set it to > false to get this to work or am I missing something so that I can leave > respectJavaAccessibility set to true? > > thank you, > Mick |